Thanks Arien, this was what I was looking for, I just couldn't figure
out what the syntax needed to be, they really should add this example
to the Django documentation.

On Jul 8, 1:30 pm, Arien <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 8, 2008 at 11:25 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > Does anyone know of an elegant way in Django to group database items
> > under 2 categories.
>
> Don't know about elegant, but something like this would work:
>
> {% regroup committees by state as committee_state_list %}
> {% for committee_state in committee_state_list %}
>   {{ committee_state.grouper }}
>   {% regroup committee_state.list by committee_type as committee_type_list %}
>   {% for committee_type in committee_type_list %}
>     {{ committee_type.grouper }}
>     {% for committee in committee_type.list %}
>       {{ committee.name }}
>     {% endfor %}
>   {% endfor %}
> {% endfor %}
>
> Arien
--~--~---------~--~----~------------~-------~--~----~
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