Thank you for the quick reply :) What I am currently doing is passing 3 separate lists to the template, each representing the column of a table so that i can do something this:
{% for i in numberOfImages %} <tr> <td> {{ images.i}} </td> <td> {{ descriptions.i}} </td> <td> {{ links.i}} </td> What is the best way to do this then? many thanks Mark On Nov 25, 1:25 pm, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, Nov 25, 2011 at 1:18 PM, marjenni <mark.jennings.em...@gmail.com> > wrote: > > Hi all, > > Why does this not work? > > > {% for i in numberOfImages %} > > <tr> > > <td> {{ images.i}} </td> > > It doesn't work because there is no variable interpolation inside a > template tag. That snippet asks for the attribute named 'i' on the > 'images' variable. > > As an earlier poster said, pass a list of images to output, and then > iterate through that list. If you need the ordinal of where you are in > the list, that is made available by the for tag: > > https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#for > > Cheers > > Tom -- 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.