On May 29, 6:15 am, Brian May <br...@microcomaustralia.com.au> wrote: > On Thu, May 28, 2009 at 11:36:10PM -0500, Alex Gaynor wrote: > > Loops put some vary helpful variables in the context, so you can do > > something like: > > > {% for pp in object.photoperson_set.all %}<a href="{{ > > pp.person.get_absolute_url }}">{{pp.person}}</a>{% if not forloop.last %}, > > {% endif %} {% endfor %} > > Thanks. Looks like just what I was after... > > I never thought of using forloop.last in an if condition like that. > -- > Brian May <br...@microcomaustralia.com.au>
Alternatively, you could use the join filter: {{ object.photoperson_set.all|join:", " }} -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---