{order1: [customer2, customer1], order2: [customer3, customer5, customer6]}
and there is no way iterating over it will yield anything but its keys
Either use `dict.iteritems()` to iterate over (key, value) pairs or iterate over it and then dereference the values corresponding to each key.
I'm guessing it's the initialization vector for the dict, though I'm not
sure why he used this for a non-ordered dict.
>>> dict([(1, [2, 3]), (5, [6, 7, 8])])
{1: [2, 3], 5: [6, 7, 8]}
>>> collections.defaultdict(lambda: [], [(1, [2, 3]), (5, [6, 7, 8])])
defaultdict(<function <lambda> at 0x1004ce488>, {1: [2, 3], 5: [6, 7, 8]})
While there are syntaxes for doing this sort of thing in the template language,
I would expect the template to start looking messy, and be hard to maintain.
May I suggest that you wrap this stuff in a class to provide attribute
like access
to the data that you need? This puts the access logic in python, and makes
the template code more transparent.
Bill
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.