#32349: unable to obtain auth template password_reset_done when using namespaced
urls
---------------------------------+---------------------------------------
Reporter: James Miller | Owner: jhabarsingh
Type: Bug | Status: closed
Component: Template system | Version: 3.1
Severity: Normal | Resolution: invalid
Keywords: password_reset | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Comment (by James Miller):
I have had no luck and so will remove the auth views from a namespace. It
should work out of the box, yet it doesn't.
I tried the following in django/contrib/auth/views
{{{
from django.urls.base import get_resolver
def set_success_url(view_name):
ns_dict = get_resolver().namespace_dict
for ns in ns_dict:
try:
candidate = ns + ':' + view_name
reverse_lazy(candidate)
return reverse_lazy(candidate)
except:
pass
return reverse_lazy(view_name)
}}}
and then setting the success_url class attribute to the function above,
but the function above needs to be lazily evaluated, or reverse_lazy
inside the function gets called long before any view classes are
instantiated, and so a circular import error occurs.
--
Ticket URL: <https://code.djangoproject.com/ticket/32349#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/074.8fced03698ad357322fdc049fd62415c%40djangoproject.com.