Re: looping over dictionaries

2010-02-15 Thread Karen Tracey
On Mon, Feb 15, 2010 at 2:54 AM, Javier Rivera wrote: > Karen Tracey wrote: > >>Now in a template I want to iterate over them as follows: >>{% for project in projects %} >>{{ project }} >> {% for chain in project.chains %} >> -- {{ chain }} >> {%

Re: looping over dictionaries

2010-02-14 Thread Javier Rivera
Karen Tracey wrote: Now in a template I want to iterate over them as follows: {% for project in projects %} {{ project }} {% for chain in project.chains %} -- {{ chain }} {% endfor %} {% endfor %} I'm usually use the values() property to iteract dictionary

Re: looping over dictionaries

2010-02-14 Thread Karen Tracey
On Sun, Feb 14, 2010 at 1:58 PM, Madis wrote: > Why will this not work or how should i write it to work: > > I have the following dictionary: > projects = {u'NetMinutes': {'chains': [u'Arendus', u'Uuslahendus']}, > u'Veel': {'chains': []}} > > Now in a template I want to

Re: looping over dictionaries

2010-02-14 Thread Skylar Saveland
{% for k, v in d.items %} {{k}} {{v}} {% endfor %} On Feb 14, 1:58 pm, Madis wrote: > Why will this not work or how should i write it to work: > > I have the following dictionary: > projects = {u'NetMinutes': {'chains': [u'Arendus', u'Uuslahendus']}, > u'Veel': {'chains':

looping over dictionaries

2010-02-14 Thread Madis
Why will this not work or how should i write it to work: I have the following dictionary: projects = {u'NetMinutes': {'chains': [u'Arendus', u'Uuslahendus']}, u'Veel': {'chains': []}} Now in a template I want to iterate over them as follows: {% for project in projects %} {{ project }} {% for