On Sun, Sep 14, 2008 at 10:00 PM, sotirac <[EMAIL PROTECTED]> wrote: > > In the django template where I am using a for loop, I have to use a > special tag (div class="yui-u first" instead of div class="yui") for > every forth item. Im trying to create a table with three columns. I > can access the first loop but how do I do it for every third. > -------------- > <pre> > {% extends "base.html" %} > > {% block content %} > {% for website in websites %} > {% if forloop.first %} > <div class="yui-u first"> > {% else %} > <div class="yui-u"> > {% endif %} > <h1><b><a href="{{website.url}}">{{ website.title > }}</a></b></ > h1> > {% for entry in website.entries_one_to_ten %} > <ul> > <li id="{{entry.url}}"><a > href="{{entry.url}}">{{ entry.title }}</a></li> > </ul> > {% endfor %} > {% if website.entries_eleven_to_twenty %} > <div id='{{website.title}}' style="display:none;"> > <div> > {% for entry in website.entries_eleven_to_twenty %} > <ul> > <li><a > href="{{entry.url}}">{{ entry.title }}</a></li> > </ul> > {% endfor %} > </div> > </div> > <a href="#" onclick="Effect.toggle('{{website.title}}', > 'slide', > { delay: 0.5 }); return false">More/Less</a> > {% endif %} > </div> > {% endfor %} > {% endblock %} > </pre>
Check the template tags. I think divisibleby might work for you. > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#divisibleby > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---