Santiago Perez wrote: > Hi, I found myself needing to reference the previous or next > element of a list within a for loop of a template. I think it > would be pretty easy to implement the following extra members > to the forloop context variable: > > + forloop.next_element > + forloop.next_counter > + forloop.next_counter0 > + forloop.previous_element > + forloop.previous_counter > + forloop.previous_counter0 > > Am I missing some very simple alternative way of doing this?
I've done this in the past with a filter as detailed in this thread: http://groups.google.com/group/django-users/browse_thread/thread/e9859caad814de7/ I haven't needed the counter because I always have the current element of the loop and can add/subtract accordingly. -tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
