-1

I tried applying this method on changing password in Django but did not work in my case.

Here's the traceback:

Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\views\decorators\debug.py" in sensitive_post_parameters_wrapper
  75.             return view(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
  22.                 return view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\contrib\auth\views.py" in password_change
  257.         post_change_redirect = reverse('password_change_done')
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in reverse
  509.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _reverse_with_prefix
  429.                              (lookup_view_s, args, kwargs, len(patterns), patterns))

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

In my urls.py:

url(r'^change-password/', 'django.contrib.auth.views.password_change'),
url(r'^password-changed/', 'django.contrib.auth.views.password_change_done'),
Community
  • 1
  • 1
Sachi Tekina
  • 1,800
  • 5
  • 28
  • 50

1 Answers1

1

Nah, it's fine...manage to figure out by myself.

Here's how:

url(r'^change-password/', 'django.contrib.auth.views.password_change',
                           {'post_change_redirect' : '/password-changed/'}),
url(r'^password-changed/', 'django.contrib.auth.views.password_change_done'),

Just added post_change_redirect.

Sachi Tekina
  • 1,800
  • 5
  • 28
  • 50