Custom password_reset_form.html not rendered

I would require some help.
Im new to django and Im building website, that will use the Django authorization management.

I have created an app accounts is to manage everything related to the users.
Inside of this app I have a folder

Inside of that i have templates:

The in the accounts app includes:
urlpatterns = [
path(‘accounts/’, include(“django.contrib.auth.urls”)),

and the main
urlpatterns = [
path(’’, include(‘accounts.urls’)),
path(‘register/’, views.register, name=“register”),

What is bodering me is that the login.html is rendered normally from the custom template, while the password_change and password_reset forms are ignored and the page redirects to the default admin page.
Any ideas what I’m missing?

Thanks for the help

Don’t know if you’ve found your answer yet or not, but a quick search of the documentation leads me to believe that you need to override the individual URLs for the password change process to specify that your own templates are to be used.

See the documentation on Authentication Views.

Hi Ken

Thx for the tip. It does kind a work with a custom individual URL, still after the form is submitted form the redirection goes to the admin password_change/done page.

According to this tutorial you should be able to simply replace the templates with custom ones with no additional URLs specified.

And my login.html template does work like that :frowning:
The other password related templates are not which is frustrating.

Any ideas.
Thx and best regards

Cool! I learned something new here.

One of the key items with it working the way described is that the templates must reside in a directory named “registration”, and you must make the settings file change to include your project-level “templates” directory in the DIRS option. Once this is done, then it should locate your registration pages before the app-based templates are found.


Hi Ken,

Yes i figured it out also now. The templates folder needs to be in the project root folder not inside of the app templates.
Works now like a charm :smiley:

Thx for the help

I had the same problem, and it solved by putting the app that handle authentication (in your case “accounts”) at the beginning (first place) of the INSTALLED_APPS list in the file. As you point out custom login file page can be called from the inside of the app templates/registration folder and you may want to keep all your files in the same place.