Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 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:

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

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by akaihola

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

comment:1 Changed 5 years ago by akaihola

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

comment:2 Changed 5 years ago by jacob

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

comment:3 Changed 5 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 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.