#33317: Add note about not overriding parent blocks within conditionals
-------------------------------------+-------------------------------------
Reporter: Nat S | Owner: nobody
Dunn |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.2
Documentation | Keywords: block,if,Template
Severity: Normal | inheritance
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When a parent block is overridden in an if condition, the overridden
content is output regardless of the truthiness of the condition. For
example:
{{{
{% if False %}
{% block parent %}Foo{% endblock parent %}
{% endif %}
}}}
Foo gets output, which feels wrong. But according to Mariusz Felisiak's
response at https://code.djangoproject.com/ticket/33311, this is by
design.
It would be great if this could be added to the documentation on
[https://docs.djangoproject.com/en/4.0/ref/templates/language/#template-
inheritance Template Inheritance].
--
Ticket URL: <https://code.djangoproject.com/ticket/33317>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.c35dba907b79af65f410e9347a5f9b76%40djangoproject.com.