Opened 4 years ago
Closed 4 years ago
#32157 closed Cleanup/optimization (worksforme)
Additional information to the "with" templatetag.
Reported by: | Jan Hangebrauck | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 3.1 |
Severity: | Normal | Keywords: | templatetags with |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
After a lot of bug searching, I found out that when I use a variable which is None in the with templatetag, it is converted to empty string "". I'm not sure if this is the intended behavior, but if it is, this could be mentioned in the documentation.
in python:
context = { var1: None }
in template:
{% with x=var1 %}
{% if x is None %}
this will not print
{% endif %}
{% if x == "" %}
this will print
{% endif %}
{% endwith %}
Attachments (1)
Change History (2)
by , 4 years ago
Attachment: | test-32157.diff added |
---|
comment:1 by , 4 years ago
Component: | Documentation → Template system |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Summary: | Additional information to the "with" templatetag → Additional information to the "with" templatetag. |
Thanks for this report, however I cannot reproduce this issue. Please check attached tests.
Tests.