On Jun 24, 12:11 pm, Masklinn <maskl...@masklinn.net> wrote: > On 24 Jun 2009, at 12:47 , James Gregory wrote: > > > > > On Jun 24, 11:41 am, James Gregory <james....@gmail.com> wrote: > >> On Jun 24, 11:15 am, "Daniele Procida" <dani...@apple-juice.co.uk> > >> wrote: > > >>> I have a template in which I would like to do the following: > > >>> {% for item in loop %} > >>> {% if [previous item].condition %} > >>> <li>item.name</li> > >>> {% endif %} > >>> {% endfor %} > > >>> In other words, I want to do something with an item in the loop > >>> based on > >>> whether the *previous* item has some condition set. > > >>> Is this possible? > > >>> Thanks, > > >>> Daniele > > >> Quite possibly someone else will give a better solution, but one
<snip> > Or zip the list with itself (with offsets where needed) and use that, > either for the transformation or for the display. Yup, that is definitely better. James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---