Malcolm Tredinnick a écrit :

> Ah, ok. So one solution is to twist your initial template a little bit.
> Normally, whenever you insert the outer "li" element (the headings), you
> really want to insert "</ul></li><li>New Heading<ul>" -- closing the
> previous inner section, displaying a heading and then starting a new
> inner section. The exception is the very first time around the loop when
> there's no previous section to close.

Ok, i see the point.

> So this should be close to what you're after:
> 
>         <ul>
>         {% for item in user_skill %}
>            {% ifchanged %}
>               {% ifnotequal forloop.counter 1 %}
>               </ul></li>
>               {% endifnotequal %}
>            <li>{{ item.name.domain }}
>               <ul>
>            {% endifchanged %}
>                   <li class="{{ item.level }}">...</li>
>         {% endfor %}
>               </ul>
>            </li>
>         </ul>
>         
> This will give slightly odd results if user_skill is empty, so you might
> want to test that first (or maybe you know otherwise that it's always
> going to contain content).

I test before if user_skill is empty or not.

At code level, it looks great but one bug. The first domain is repeated 
twice whereas for the rest it works like a charm. I will try to see if 
it"s a grouping issue or a template one.

Nicolas


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to