32smooth
32smooth

Reputation: 47

django auth password reset - NoReverseMatch

I'm trying to get the password reset to work. I used this tutorial

Django Version 1.5.1

When I enter the email adress and hit the "Reset Password" button I get an error message:

Exception Type: NoReverseMatch
Exception Value: Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb36': u'q', u'token': u'3ky-999ef6e52ef0743cdb2a'}' not found.

The cause seems to be:

{{ protocol }}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}

my urls.py:

url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', {'post_reset_redirect' : 'user/password/reset/done/','template_name': 'main/registration/password_reset_form.html'}, name="password_reset"),
url(r'^user/password/reset/done/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'main/registration/password_reset_done.html'}),
url(r'^user/password/reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name': 'main/registration/password_reset_confirm.html', 'post_reset_redirect' : 'user/password/done/'}),
url(r'^user/password/done/$', 'django.contrib.auth.views.password_reset_complete',{'template_name': 'main/registration/password_reset_complete.html'})

I'm trying around for several hours now, maybe someone can give me a hint. Many thanks in advance.

Upvotes: 1

Views: 3137

Answers (3)

Xiao Hanyu
Xiao Hanyu

Reputation: 1410

You should include the following line in your urls.py: url(r'^accounts/', include('django.contrib.auth.urls')), since django-regisration will call some functions from django.contrib.auth.

I've create a complete demo for django-registration, see https://github.com/xiaohanyu/django-registration-demo.

Upvotes: 0

Joyfulgrind
Joyfulgrind

Reputation: 2836

Namespaces are used to differentiate same URLs between various application. So, it's always a very good practice to use namespace. For example if namespace is specified in project urls as :

url(r'^courses/', include('courses.urls', namespace="courses")),

You do:

<a href="{% url 'courses:lecturedetail' i.id %}">{{ i.title }}</a>

Here courses is a namespace.

Upvotes: 1

32smooth
32smooth

Reputation: 47

Ok these url-lines where part of a namespaced url.conf that was included into the root url-conf ... well, removing the namespace option solved it for now.

Upvotes: 0

Related Questions