Code

Opened 6 years ago

Closed 6 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'

Attachments (0)

Change History (2)

comment:1 Changed 6 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 6 years ago by anonymous

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

duplicate of #7501

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.