def dispatch(self, request, *args, **kwargs):
    user = self.request.user
    profile = Profile.objects.get(user=self.request.user)
    view_profile = Profile.objects.get(id=self.kwargs['pk'])
    friendship = Friendship(from_user=profile, to_user=view_profile, status=False)
    friendship.save()
    messages.info(self.request, 'Friendship requested.')
    return HttpResponseRedirect(reverse('profiles:view', kwargs={'pk': self.kwargs['pk']}))
def dispatch(self, request, *args, **kwargs):
    user = self.request.user
    profile = Profile.objects.get(user=self.request.user)
    view_profile = Profile.objects.get(id=self.kwargs['pk'])
    friendship = Friendship(from_user=profile, to_user=view_profile, status=False)
    friendship.save()
    messages.info(self.request, 'Friendship requested.')
    return HttpResponseRedirect(reverse('profiles:view', kwargs={'pk': self.kwargs['pk']}))