dopatraman
dopatraman

Reputation: 13908

Unable to extend Django 2.1 password reset template

I'm trying to extend the password reset form like so:

<!-- templates/registration/password_reset_form.html -->
{% extends registration/password_reset_form.html %}

{% block content %}
<h1> hello </h1>
{% endblock %}

As far as I can tell, this should take the template from /usr/local/lib/python3.7/site-packages/django/contrib/admin/templates/registration/password_reset_template.html (which exists, I checked) and replace the block content with the one at templates/registration/password_reset_form.html.

But this isn't happening. In fact, there is no change, nor is there an error. What am I doing wrong?

UPDATE:

I tried deliberately introducing a syntax error into the template name, and no error was issued. It leads me to believe that the template file is not being read at all. According to the django docs, registration/password_reset_form.html is the path to the default template. Why am I not able to at least introduce an error?

Upvotes: 1

Views: 88

Answers (2)

Gasanov
Gasanov

Reputation: 3399

Put quotes around path, like this:

{% extends "registration/password_reset_form.html" %}

{% block content %}
<h1> hello </h1>
{% endblock %}

enter image description here

Also if your own template file didn't read at all, make sure that you have your app in INSTALLED_APPS in settings.py and TEMPLATES has 'APP_DIRS': True or DIRS set properly.

Upvotes: 1

Michael Calve
Michael Calve

Reputation: 21

Why don't you just use the full path to the html file then? /usr/local/lib/python3.7/site-packages/django/contrib/admin/templates/registration/password_reset_template.html

Right now you are extending the same file you are working on

Upvotes: 0

Related Questions