我希望重写django.contrib.auth.urls中的模板,其中包括accounts/password_reset/[name='password_reset']。但是我无法使用我的模板替换此URL的Django管理模板。根据文档,我的模板位于registration/password_reset_form.html,但不起作用。
我希望重写django.contrib.auth.urls中的模板,其中包括accounts/password_reset/[name='password_reset']。但是我无法使用我的模板替换此URL的Django管理模板。根据文档,我的模板位于registration/password_reset_form.html,但不起作用。
你是否在使用CBV(基于类的视图)?在views.py或urls.py中设置template_name
。
例如:
path('question_directory/', views.UpdateDirectry.as_view(template_name='accounts/profile_form.html'), name='question_directory')
或者
class UpdateDirectry(generic.edit.FormView):
model = Question
template_name = 'accounts/editable_directory.html'