On Mon, 2007-10-01 at 14:59 -0700, Greg wrote: > Hello, > I have a table in my template that will contain an x number of rows > depanding on what I get back from the view. I want my table row > background color to rotate between red and white. As of now, I don't > know how to keep track of each iteration through my for loop to set > the appropriate bgcolor. > > Any suggestions?
This is documented in the documentation for the "for" tag (which is what I presume you are using to iterate over the table rows). Have a look at the forloop.counter and forloop.counter0 variables you have access to in the template (see [1]). However, for this type of use-case, the cycle tag ([2]) is probably more what you need. [1] http://www.djangoproject.com/documentation/templates/#for [2] http://www.djangoproject.com/documentation/templates/#cycle Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---