Opened 16 years ago

Last modified 10 years ago

#6646 closed

included template blocks are not being overrided by parent template. — at Initial Version

Reported by: anonymous Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords: include, extends, block
Cc: michael@…, tom@…, mmitar@…, drackett@…, dueSouth, botondus@…, dev@…, flisky Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When including a template into a parent template, the child-template's blocks are not overridden by the parent.

For example:

base.html
{% if is_satchmo %}
{% include "satchmo_base.html" %}
{% else %}
{% include "journal_base.html" %}
{% endif %}

journal_base.html contains the following block:
{% block content%}{% endblock %}

view_template.html extends base.html (with the context variable is_satchmo == False). view_template.html contains {% block content%}{% endblock %} which should filled with data from the view's context variable.

If I rename journal_base.html to base.html - everything works fine - but when I use the version of base.html that relies on the include tag, {% block content %} doesn't get overridden.

The documentation says that context vairables are available to included templates, so not being able to override blocks seems like a bug.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top