Re: How to get next and previous element in a forloop in the template

2011-03-10 Thread Derek
On Mar 7, 10:43 pm, Ariel wrote: > Could you give some idea ??? > I am sorry about the previous message I had not finished. > > Any help is appreciated. > Regards. > > > > > > > > On Mon, Mar 7, 2011 at 3:39 PM, Ariel wrote: > > Hi everybody: > > > I would want to know in the django template tags

Re: How to get next and previous element in a forloop in the template

2011-03-08 Thread Bill Freeman
Apart from writing your own for tag, you could, for instance, supply a generator (or equivalent) on your model, or passed in by your view, that returns 3 tuples of (this, prev, next), or perhaps easier to read in the template, toy objects having this, prev, and next attributes (or properties). On

Re: How to get next and previous element in a forloop in the template

2011-03-07 Thread Ariel
Could you give some idea ??? I am sorry about the previous message I had not finished. Any help is appreciated. Regards. On Mon, Mar 7, 2011 at 3:39 PM, Ariel wrote: > Hi everybody: > > I would want to know in the django template tags how to get the next and > the previous element when I am it

How to get next and previous element in a forloop in the template

2011-03-07 Thread Ariel
Hi everybody: I would want to know in the django template tags how to get the next and the previous element when I am iterating in the forloop, I haven't found something similar, for instance I would want something like this: {% for element in list_elements %} {{forloop.get_prev_element.title}} {