Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#10644 closed (fixed)

undocumented context side-effect in {% ifchanged %}

Reported by: akaihola 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:


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 akaihola 7 years ago.
Patch: stop {% ifchanged %} from changing context, includes test

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by akaihola

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

comment:1 Changed 7 years ago by akaihola

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.0 to SVN

comment:2 Changed 7 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(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 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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