I have been unable to wrap my brain around a simple solution for the
following.  I have a list of items that have a category and
subcategory.  I would like to print them out in a hierarchy using the
template system.

items = [
    {
    'name' : 'item1',
    'category' : 'foo',
    'subcategory' : 'bar'
    },
    {
    'name': 'item2',
    'category': 'foo'
    'subcategory': 'fnord'
    }
    {
    'name': 'item3'
    'category' : 'notfoo',
    'subcategory': 'bar'
    }]

Ideally this would print out as:
foo
    bar
        item1
    fnord
        item2
notfoo
    bar
        item3

I know I can use regroup to handle the categories, or pass in a
separate list of categories altogether, but I come up short when
trying to handle the subcategories.  Would someone throw me a bone on
the best way to tackle this?

Thanks,
Lance


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