I have a template that includes other templates. It contains block tags in the template. Example:
base.html
base {% block title%} Base title {% endblock%} {% Block content%} { Expanded {% block title%} Expanded title {% endblock%} <% 2 $ {endpoint%}
template1.html
} {% Block content%} extended content {% include 'include.html'%} {% endblock%}include.html
{% Block title%} include {% endblock%} {% endblock%} {% block other_content%} content {% endblock%}
What do I expect if I submit the template I should get it , Which I am 1.1.1
But when I went to 1.2.1 and 1.2.3 then get it: p>
base expanded title include extended content content. Base Extended Title Include Extended Content Expanded Title Content
As you can see the title block of the Title block template1.html in Include.html Is replaced with this replacement only if the block is not I am the same, so if I change the title block in include.html, it does not happen that I think it is included at the same time and is expanding? Anyone know what is expected / I am doing something wrong?
If you are not using
include.html
in this behavior is normal - I think there was a bug in 1.1.1.
Excerpt from official documents:
Finally, note that you can not define several {% block%} tags with the same name in a single template . This limitation exists because the block tag works in "both" directions, it does not provide just one hole to fill a block tag - it also defines the content that fills the hole in the parent If the template has two identical {% block%} tags in the template, then the template's parent would not know which block material to use.
Read the whole thing here:
Comments
Post a Comment