﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34003	PasswordResetView and PasswordResetConfirmView not discovering custom template	Brylie Christopher Oxley	nobody	"While defining URLs for a user password reset flow, I am using standard Django views such as PasswordResetView. 

{{{#!python
path(
    ""password_reset/"",
    django.contrib.auth.views.PasswordResetView.as_view(),
    name=""password_reset"",
),
path(
    ""reset/<uidb64>/<token>/"",
    auth_views.PasswordResetConfirmView.as_view(),
    name=""password_reset_confirm"",
),
}}}

The [https://docs.djangoproject.com/en/4.1/topics/auth/default/#django.contrib.auth.views.PasswordResetView PasswordResetView] and  [https://docs.djangoproject.com/en/4.1/topics/auth/default/#django.contrib.auth.views.PasswordResetView PasswordResetConfirmView] docs say it will look for a template called ''registration/password_reset_form.html'' and ""registration/password_reset_confirm.html"" respectively and render that if available. When I define a template with the same name and location, the custom template is not discovered by the PasswordResetView nor PasswordResetConfirmView. Instead, the default Django Admin templates are rendered. This is despite other built in views like LoginView being able to fine conventionally named templates in the ''same'' directory.

Of note, the two problematic views are both responsible for rendering and validating forms during the password reset flow.

In order to work around the issue, I have had to move the custom template to a different template path specified via the template_name argument to the PasswordResetView:

{{{#!python
path(
    ""password_reset/"",
    django.contrib.auth.views.PasswordResetView.as_view(
        template_name=""accounts/password_reset_form.html"",
    ),
    name=""password_reset"",
),
path(
    ""reset/<uidb64>/<token>/"",
    auth_views.PasswordResetConfirmView.as_view(
        template_name=""accounts/password_reset_confirm.html"",
    ),
    name=""password_reset_confirm"",
),
}}}

In honesty, it is very possible that I have made a typo in the file name, but I have tried multiple times with the same result."	Uncategorized	new	contrib.auth	4.1	Normal				Unreviewed	0	0	0	0	0	0
