How to use password_change function from django.contrib.auth.views

127 views
Skip to first unread message

Juan Sebastian Avila Rodriguez

unread,
Jun 27, 2016, 11:39:23 AM6/27/16
to Django users
I tried to implement the password_change view but is not working. I only add the code below to the urls.py:

from django.contrib.auth import views as auth_views
...
url(
        r'^change-password/$',
        auth_views.password_change,
        name='change_password'
    ),
url(
        r'^change-password/done$',
        auth_views.password_change_done,
        name='change_password_done'
),
...

In the base.html template. Add the <a> tag with href="{% url 'change_password' %}". When I click on it. I get this error:

NoReverseMatch at /change-password/
Reverse for 'password_change_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Thank you for your help.

Tim Graham

unread,
Jun 28, 2016, 9:56:35 PM6/28/16
to Django users
You need a url() with name='password_change_done' -- instead you wrote 'change_password_done'.
Reply all
Reply to author
Forward
0 new messages