#17230: Broken boolean comparison in template 'if' '==' expression
-------------------------------------------------+--------------------
Reporter: anatoly techtonik <techtonik@…> | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------------------+--------------------
I pass `closed` boolean variable to template, which can have three values
- None, True, False. I want string `*****` to show only if closed is True.
{{{
_{{closed}}_
{%if closed == True%} ***** {%endif%}
{%if closed == 'True'%} ***** {%endif%}
}}}
I am surprised to see that `*****` output twice when `closed` is None, and
doesn't show if `closed` boolean is set regardless of its value. I expect
numerous complaints about that, but couldn't any open reports, so I
imagine it is 'feature' of template engine, but for me such ugly feature
is a bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/17230>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.