On Thu, Mar 25, 2010 at 3:57 PM, mhulse <rgmi...@gmail.com> wrote: > Hi! > > Example code: > > ========== > > {% for pretty_date, days_events in date_days_events_tuple %} > ... > <div> > ... > {% for details in days_events %} > <li class="{% cycle "odd" "even" %}">...</li> > ... > {% endfor %} > ... > </div> > ... > {% endfor %} > > ========== > > The output: > > ========== > > <div><li ...odd...>...<li ...even...>...<li ...odd...></div> > <div><li ...even...>...<li ...odd...>...<li ...even...></div> > <div><li ...odd...>...</div> > > ========== > > What I really want: > > ========== > > <div><li ...odd...>...<li ...even...>...<li ...odd...></div> > <div><li ...odd...>...<li ...even...>...<li ...odd...></div> > <div><li ...odd...>...</div> > > ========== > > This must be a complete noob question. Sorry 'bout that. :D > > Thanks! > Micky
You might be able to use the {% cycle "odd" "even" as variable %} form and then, after your first endfor: <!-- {% ifequal variable "odd" %}{% cycle variable %}{% endifequal *} --> I *think* that you want "odd" in the ifequal. Looking at the render code, the variable appears to be left in the state that was last rendered. So, if when you look at it it is "odd" then the next rendering would be "even", so we do an extra cycle in this case, making "odd" be next, for the first cycle in the next run of the inner loop. But if it doesn't work, try "even". There may be a more elegant way to eat the extra rendering than the html comment, but I can't think of it off hand. Bill -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.