#16297 closed Bug (fixed)
unexpected behavior with make_list filter
Reported by: | ned | Owned by: | teraom |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
When using the make_list filter I would expect the following code to print 'foo' on the first iteration. But the conditional fails.
{% for i in 12345|make_list %} {{i}}: {% if 1 == i %}foo{% endif %} {% endfor %}
Forcing the variable i to be an int with the following hack makes it work, but from reading the make_list documentation I thought it should already be an integer.
{% if 1 == i|add:0 %}foo{% endif %}
Am I missing something about the limitations of conditionals in the templating system?
Attachments (1)
Change History (6)
comment:1 by , 13 years ago
Component: | Template system → Documentation |
---|---|
Easy pickings: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 13 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
by , 13 years ago
Attachment: | make_list_integer-16297.diff added |
---|
comment:3 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
This is a bug in the documentation.
make_list
systematically casts the argument to a unicode string before creating the list: