If you are in a for loop you can test whether you are at the end. Otherwise I think you'd have to do it in the view.
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for On 2009-09-03, at 9:01 PM, watusee wrote: > > I'm attempting to get the first and last items in a set inside a > django template. The first is no problem: > > {{ course.coursepart_set.all.0.begin_date }} > > but I can't figure out how to get the last item without knowing the > length of the set. Is there a way to do this? > > Something like (theoretically): > > {{ course.coursepart_set.all.LAST.end_date }} > > kind regards, > > -raymond > > -- Andy McKay Clearwind Consulting: www.clearwind.ca Twitter: @clearwind --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---