def form_invalid(self, form):
"""
The user has provided invalid credentials (this was checked in
AuthenticationForm.is_valid()). So now we set the test cookie again
and re-render the form with errors.
"""
self.set_test_cookie()
if form.has_error(NON_FIELD_ERRORS, 'admin_user'):
return HttpResponseRedirect('/admin/')
return super(LoginView, self).form_invalid(form)
评论列表
文章目录