Opened 12 years ago
Closed 12 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 |
Description
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.
Note:
See TracTickets
for help on using tickets.
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.