Changing password views

We also need our users to be able to change their password after they log in to our site. We will integrate Django authentication views for password change. Open the urls.py file of the account application and add the following URL patterns to it:

# change password urlspath('password_change/',     auth_views.PasswordChangeView.as_view(),      name='password_change'),path('password_change/done/',      auth_views.PasswordChangeDoneView.as_view(),       name='password_change_done'),

The PasswordChangeView view will handle the form to change the password, and the PasswordChangeDoneView view will display a success message after the user has successfully changed his password. Let's create a template for each view.

Add a new file inside the ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.