Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19890 closed Cleanup/optimization (fixed)

ifchanged tag renders the nodelist_true part twice

Reported by: Diederik van der Boor Owned by: nobody
Component: Template system Version: 1.4
Severity: Normal Keywords: sprint2013
Cc: chrismedrela 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

The {% ifchanged %}foo{% endifchanged %} node renders the contents twice;

  • First to compare it with the previous value
  • The second time to return the rendered output.

This was discovered while fixing 15849

Attachments (1)

19890-fix-double-ifchanged-rendering.patch (2.2 KB ) - added by Diederik van der Boor 12 years ago.

Download all attachments as: .zip

Change History (8)

by Diederik van der Boor, 12 years ago

comment:1 by Diederik van der Boor, 12 years ago

The patch can be applied after merging #15849

comment:2 by Jacob, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Bas Peschier, 12 years ago

Keywords: sprint2013 added

comment:4 by chrismedrela, 12 years ago

Cc: chrismedrela added
Triage Stage: AcceptedReady for checkin

The patch seems good to me. I simplified the test and added pull request: https://github.com/django/django/pull/832.

comment:5 by Christopher Medrela <chris.medrela@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 636c45fc58bcc19d7669a739ccd05ff475381f48:

Fixed #19890 -- ifchanged templatetag rendered its content twice

The content of ifchanged template tag was rendered twice: first time, to
compare it with the previous value and the second time, to return the
rendered output.

comment:6 by Preston Holmes <preston@…>, 12 years ago

In e369dc28075b4331c125494fe7bd73855d73a0ce:

Merge pull request #832 from chrismedrela/ticket19890

Fixed #19890 -- ifchanged templatetag rendered its content twice

comment:7 by Julien Phalip <jphalip@…>, 12 years ago

In ae2a8bb4569e569d0cc2cd8173443862418d3698:

Fixed a test that was failing in Python 3.
The issue was that as of Python 3, the generators' next()
method becomes __next(). Thanks Alex Gaynor for noticing that.
Refs #19890.

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