#17230: Broken boolean comparison in template 'if' '==' expression
-------------------------------------+-------------------------------------
Reporter: anatoly techtonik | Owner: nobody
<techtonik@…> | Status: reopened
Type: Bug | Version: 1.2
Component: Template system | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by charettes):
techtonik, I know you stated you need to distinguish between {{{closed ==
None}}} and {{{closed == False}}} in #17229 but I can't find that
statement in the above description. You only state that ''you want string
* * * * to show only if closed is True.'' which is the question ptone
answered to.
Why not use the solution proposed by lukeplant in #17229
{{{
{% if closed == None %}
Works since None is an undefined variable
{% else %}{% if closed %}
True
{% else %}
False
{% endif %}{% endif %}
}}}
IMHO the main reason why boolean expressions are not allowed in there is
because they are not mandatory. Don't you think that {{{{% if closed %}}}}
makes more sense than {{{{% if closed == True %}}}}? It might be the
reason why not so many people stumbled on this.
--
Ticket URL: <https://code.djangoproject.com/ticket/17230#comment:3>
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.