diff options
| author | Victor <victormovileanu@gmail.com> | 2022-07-22 10:09:29 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-07-22 10:10:23 +0200 |
| commit | 8a2e65c2e6ed7fb2607ebb70142ebf4488f15d41 (patch) | |
| tree | 1ac0ecba729ee18fdbcad4dc4a4fe1fd14c868e8 /docs | |
| parent | 70147215bb848539273b42617b32773013bcdc47 (diff) | |
[4.1.x] Fixed #33317 -- Added note about unconditional evaluation of {% block %} tags.
Backport of 2fac0a18081dcc77fc860c801e5d727dc90435b3 from main
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/templates/language.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/templates/language.txt b/docs/ref/templates/language.txt index f80d2a52f6..5a4cce379b 100644 --- a/docs/ref/templates/language.txt +++ b/docs/ref/templates/language.txt @@ -431,6 +431,15 @@ Here are some tips for working with inheritance: In larger templates, this technique helps you see which ``{% block %}`` tags are being closed. +* :ttag:`{% block %}<block>` tags are evaluated first. That's why the content + of a block is always overridden, regardless of the truthiness of surrounding + tags. For example, this template will *always* override the content of the + ``title`` block:: + + {% if change_title %} + {% block title %}Hello!{% endblock title %} + {% endif %} + Finally, note that you can't define multiple :ttag:`block` tags with the same name in the same template. This limitation exists because a block tag works in "both" directions. That is, a block tag doesn't just provide a hole to fill -- |
