#27726: Template default_if_none filter is inconsistent between printed value
and
boolean context
-------------------------------------------+------------------------
Reporter: Tim Martin | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I have the template
{{{
x={{x}}
y={{y}}
x|default_if_none:y={{x|default_if_none:y}}
{% if x|default_if_none:y %}
x|default_if_none:y is apparently True
{% endif %}
}}}
If `x` is unset (a missing variable in the template context) and `y` is
set to `True`, then this prints:
{{{
x=
y=True
x|default_if_none:y =
x|default_if_none:y is apparently True
}}}
This indicates that `x:default_if_none:y` evaluates to `True` in the
boolean context, but doesn't print a value when evaluated directly.
--
Ticket URL: <https://code.djangoproject.com/ticket/27726>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.77fe6d580dcc8b52203333e9e9699978%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.