Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10644 closed (fixed)

undocumented context side-effect in {% ifchanged %}

Reported by: Antti Kaihola Owned by: nobody
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The {% ifchanged %} template tag sets the {{ ifchanged }} variable in its local context, in a way similar to how {% for %} sets the {{ forloop }} variable. This behavior is not documented. The value stored into the variable is a dictionary and doesn't seem to have any use elsewhere in Django. Maybe it's related to some removed functionality?

These quick Google code searches didn't turn up any uses of the context variable in indexed open source projects either:

The following patch stops {% ifchanged %} from touching the context and adds a test for this.

Attachments (1)

10644_ifchanged.1.diff (1.6 KB) - added by Antti Kaihola 8 years ago.
Patch: stop {% ifchanged %} from changing context, includes test

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by Antti Kaihola

Attachment: 10644_ifchanged.1.diff added

Patch: stop {% ifchanged %} from changing context, includes test

comment:1 Changed 8 years ago by Antti Kaihola

Version: 1.0SVN

comment:2 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

(In [10438]) Fixed #10644: removed an undocumented, unused, and (as far as I can tell) unnecessary "feature" of the ifchanged tag. Thanks, akaihola.

comment:4 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top