def post(self, request, *args, **kwargs):
"""Called by `TemplateView`: handle a POST request."""
self.object = user = self.get_object()
next_page = reverse('settings')
# Process the profile-editing form, if that's what was submitted.
profile_form, response = process_form(
request, EditUserForm, next_page, 'profile', "Profile updated.",
{'instance': user})
if response is not None:
return response
# Process the password change form, if that's what was submitted.
password_form, response = process_form(
request, AdminPasswordChangeForm, next_page, 'password',
"Password updated.", {'user': user})
if response is not None:
return response
return self.respond(request, profile_form, password_form)
评论列表
文章目录