Python 2.7.1 / Django 1.3
I am new to Django Templates and trying to do very simple template inheritance.
testbase.html
hello
{% block tester %}
fail
{% endblock %}
testblock.html
{% extends "testbase.html" %}
{% block tester %}
pass
{% endblock %}
result
hello fail
The two templates are in the same directory which has been added to the project settings.py file and since it finds the base template I’m having trouble finding why it wouldn’t be able to find the child template.
Thanks for any ideas on what to try next.
In your view, you need to make sure the template you are pointing to is
testblock.htmland nottestbase.html.Assuming you’re using
render_to_response, it would look something like:If your view function is referencing
testbase.html, then you’ll get the unextended template. That’s by design.Here’s a link to the template documentation for good measure. 🙂