I am trying to upgrade my webapp from Django 1.5 to Django 1.6 and as part of my set of django apps I am using django-registration 1.0.
After upgrading to Django 1.6 my app does not recognize the built-in authentication views any more. They are integrated in django registration as can be seen here, but they stopped working.
The Django release notes describe a change in the way these views should be integrated, when comparing that to the source code in the registration-app that looks fine.
I am introducing the registration urls as follows:
urlpatterns = patterns('',
...,
url(r'^accounts/', include('registration.backends.default.urls')),
)
I get the an error when requesting the built in urls such as /accounts/password/change/
django.core.urlresolvers.NoReverseMatch
NoReverseMatch: Reverse for 'password_change_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Does anyone have an idea why I get a no-reverse-match error?
The reason for this error is that the django.contrib.auth.views
use different url names than the registration.auth_urls
ones. To patch this problem, override the default urls until django-registration gets updated for django 1.6, and use the same names as Django.
from django.contrib.auth import views as auth_views
urlpatterns = patterns('',
#override the default urls
url(r'^password/change/$',
auth_views.password_change,
name='password_change'),
url(r'^password/change/done/$',
auth_views.password_change_done,
name='password_change_done'),
url(r'^password/reset/$',
auth_views.password_reset,
name='password_reset'),
url(r'^password/reset/done/$',
auth_views.password_reset_done,
name='password_reset_done'),
url(r'^password/reset/complete/$',
auth_views.password_reset_complete,
name='password_reset_complete'),
url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
auth_views.password_reset_confirm,
name='password_reset_confirm'),
#and now add the registration urls
url(r'', include('registration.backends.default.urls')),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With