def dispatch(self, request, *args, **kwargs):
    user = self.request.user
    obj = self.get_object()
    if (obj.user != user):
        messages.error(self.request, 'This profile is not yours.')
        return HttpResponseRedirect(reverse('dashboard'))
    return super(ProfileUpdate, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs):
    user = self.request.user
    obj = self.get_object()
    if (obj.user != user):
        messages.error(self.request, 'This profile is not yours.')
        return HttpResponseRedirect(reverse('dashboard'))
    return super(ProfileUpdate, self).dispatch(request, *args, **kwargs)