Opened 7 years ago

Closed 7 years ago

#18598 closed Uncategorized (invalid)

Django template language comparisons with None

Reported by: Renato Oliveira Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: fernandogrd@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


PEP 8 says:
"Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators."

I don't know if it's a bug or a new feature, but {% if something is None %} doesn't work.

Change History (1)

comment:1 Changed 7 years ago by Aymeric Augustin

Resolution: invalid
Status: newclosed

PEP 8 is about Python; it doesn't apply to the Django template language. The DTL doesn't attempt to mimic Python.

See the "Philosophy" note at the beginning of the template docs.

Note: See TracTickets for help on using tickets.
Back to Top