Opened 16 years ago
Closed 16 years ago
#7321 closed (invalid)
Rendering of file in the {% include %} Tag in Template doesnt work if the block defined in the base template is not included in the final template being rendered
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | Include Tag | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
http://dpaste.com/53430/ (Doesnt Work)
http://dpaste.com/53434/ (Works)
Doesnt Work (Show Me is NOT rendered in the page displayed)
base.html
<body>
{% block overwrite %}
{% endblock overwrite %}
</body>
file_to_be_included.html
{% block overwrite %}
<p>Show Me</p>
{% endblock %}
file_rendered_to_response.html
{% extends base.html %}
{% include 'file_to_be_included.html' %}
Works (Show Me is Rendered in the page displayed)
base.html
<body>
{% block overwrite %}
{% endblock %}
</body>
file_to_be_included.html
<p>Show Me</p>
file_rendered_to_response.html
{% extends base.html %}
{% block overwrite %}
{% include 'file_to_be_included.html' %}
{% endblock %}
Everything a child template does has to be within a block which was defined in the parent template. So it's expected that an {% include %} from a child parent which is not inside a block won't work.