id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux
2026 If statement doesn't allow for 'and' chaining.. anonymous Adrian Holovaty "It could be handy and provide better structure if `and` as well as `or` chaining were allowed in an `if` statement.
`and` and `or` should mix, because it would be ambiguous, thus raising a `TemplateSyntaxError`.
In this template:
{{{
{% if 1 and 1 %}good 1 and 1
{% endif %}
{% if 1 and 0 %}bad 1 and 0
{% endif %}
{% if 0 and 1 %}bad 0 and 1
{% endif %}
{% if 0 and 0 %}bad 0 and 0
{% endif %}
{% if 1 or 1 %}good 1 or 1
{% endif %}
{% if 1 or 0 %}good 1 or 0
{% endif %}
{% if 0 or 1 %}good 0 or 1
{% endif %}
{% if 0 or 0 %}bad 0 or 0
{% endif %}
}}}
should display:
{{{
good 1 and 1
good 1 or 1
good 1 or 0
good 0 or 1
}}}
and this template:
{{{
{% if 1 and 1 or 1 %}error 1 and 1 or 1
{% endif %}
}}}
should cause a `TemplateSyntaxError` (because `and` mixed with `or`)." enhancement closed Template system dev normal fixed Unreviewed 0 0 0 0 0 0