Reputation: 3
Python 2.7.1 / Django 1.3
I am new to Django Templates and trying to do very simple template inheritance.
hello
{% block tester %}
fail
{% endblock %}
{% extends "testbase.html" %}
{% block tester %}
pass
{% endblock %}
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.
Upvotes: 0
Views: 601
Reputation: 9428
In your view, you need to make sure the template you are pointing to is testblock.html
and not testbase.html
.
Assuming you're using render_to_response
, it would look something like:
return render_to_response('testblock.html')
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. :)
Upvotes: 2