Ticket #8493: 8493.hackish_try_except_to_get_admin_working.diff
File 8493.hackish_try_except_to_get_admin_working.diff, 1.5 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/views.py
4 4 from django.contrib.auth.forms import AuthenticationForm 5 5 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm 6 6 from django.contrib.auth.tokens import default_token_generator 7 from django.core.urlresolvers import reverse 7 from django.core.urlresolvers import reverse, NoReverseMatch 8 8 from django.shortcuts import render_to_response, get_object_or_404 9 9 from django.contrib.sites.models import Site, RequestSite 10 10 from django.http import HttpResponseRedirect, Http404 … … 136 136 form = PasswordChangeForm(request.user, request.POST) 137 137 if form.is_valid(): 138 138 form.save() 139 return HttpResponseRedirect(reverse('django.contrib.auth.views.password_change_done')) 139 try: 140 return HttpResponseRedirect(reverse('django.contrib.auth.views.password_change_done')) 141 except NoReverseMatch: 142 # Admin interfaces don't hook contrib.auth urls into anything 143 # that reverse() can find, so we do something absurdly hackish 144 # here so we don't have to rewrite the entirety of admin.sites.root 145 return HttpResponseRedirect('done/') 140 146 else: 141 147 form = PasswordChangeForm(request.user) 142 148 return render_to_response(template_name, {