Code

Opened 6 years ago

Closed 6 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: ashutoshb@… Owned by: nobody
Component: Template system Version: master
Severity: Keywords: Include Tag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 %}

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.