On Oct 19, 2006, at 7:35 AM, [EMAIL PROTECTED] wrote: > > Cycle is interesting (haven't used it), but here's how I do it: Works > well, and it appears to me it may have some advantages over cycle. > > <tr {% if forloop.counter|divisibleby:"2" %} class="even"{% endif %}>
Note that cycle is not restricted to just two rows, you can have as many alternating colors as items in the cycle argument. You can also assign a cycle value to a variable and use that variable without using a loop, say if you have a small hard-coded table with just a few rows that you want alternate colors applied to: <table> <tr class="{% cycle row1, row2 as rowcolors %}">...</tr> <tr class="{% cycle rowcolors %}">...</tr> <tr class="{% cycle rowcolors %}">...</tr> <tr class="{% cycle rowcolors %}">...</tr> </table> Don --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---