How to use the built in password reset/change views with my own templates with Python Django?

Sometimes, we want to use the built in password reset/change views with my own templates with Python Django.

In this article, we’ll look at how to use the built in password reset/change views with my own templates with Python Django.

How to use the built in password reset/change views with my own templates with Python Django?

To use the built in password reset/change views with my own templates with Python Django, we can create our own view that returns the response returned by the password_reset function.

For instance, we write

from django.contrib.auth.views import password_reset

def my_password_reset(request, template_name='path/to/my/template'):
    return password_reset(request, template_name)

to create the my_password_reset view function.

In it, we call password_reset(request, template_name) to return the response that renders the password reset form template.

Conclusion

To use the built in password reset/change views with my own templates with Python Django, we can create our own view that returns the response returned by the password_reset function.