Opened 7 years ago

Closed 7 years ago

#9521 closed (duplicate)

cycle templatetag is nondeterministic

Reported by: hauser Owned by: nobody
Component: Template system Version: 1.0
Severity: Keywords: cycle nondeterministic templatetag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It can bite you when for example you are coloring rows in your table in some pattern. After refresh you may get different coloring (if you use the sample compiled template, which is not true for default django template processing).

from django.template import Context, Template
t = Template("{% cycle 1 2 3 %}")
t.render(Context())

u'1'

t.render(Context())

u'2'

t.render(Context())

u'3'

t.render(Context())

u'1'

Change History (2)

comment:1 Changed 7 years ago by hauser

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Formatted code:

>>> from django.template import Context, Template
>>> t = Template("{% cycle 1 2 3 %}")
>>> t.render(Context())
u'1'
>>> t.render(Context())
u'2'
>>> t.render(Context())
u'3'
>>> t.render(Context())
u'1'

comment:2 Changed 7 years ago by anonymous

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

duplicate of #7501

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