Opened 3 years ago

Closed 3 years ago

#18598 closed Uncategorized (invalid)

Django template language comparisons with None

Reported by: renatooliveira 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 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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