Opened 17 years ago
Closed 16 years ago
#6322 closed (fixed)
ifchanged doesn't properly reset itself if not evaluated each time through the loop
Reported by: | Ned Batchelder | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When using ifchanged in a doubly-nested loop, the value is only reset to None on the inner loop's first iteration. But if the ifchanged tag is inside another conditional, it may not be evaluated on the first iteration. This can mean the value isn't properly reset:
{% for data in datalist %} {% for c,d in data %} {% if c %} {% ifchanged %}{{ d }}{% endifchanged %} {% endif %} {% endfor %} {% endfor %}
The fix is to not examine forloop.first explicitly, but to annotate the forloop context.
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | ifchanged.diff added |
---|
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
the patch!