2010/1/20 Christopher Bird <birdchristoph...@gmail.com>: > Hi > > Im trying iterating over a dictionary. > i have no problem with this but when i get to the last key:value > ( value is a list) i get the following error > > > value= list > TypeError: 'float' object is not iterable > > > > django code > > > {% for states in prices_demand.items %} > > <h1> > {{ states.0 }} > </h1> > {{ states.1.items.2.0 }}={{ states.1.items.2.1 }}<br> > > {{ states.1.items.0.0 }}={{ states.1.items.0.1 }}<br> > > {{ states.1.items.3.0 }}={{ states.1.items.3.1 }}<br> > > {{ states.1.items.5.0 }}={{ states.1.items.5.1 }}<br> > > {{ states.1.items.7.0 }}={{ states.1.items.7.1 }}<br><br> > > > > {{ states.1.items.6.0 }}<br> > > > <! This is were django messes up> > > {% for x in states.1.items.6.1 %} > > {{ x }} > > {% endfor %} > {% endfor %} > > > Am i asking django to do too much??
Looks to me like prices_demand.items is a dictionary, but whatever is in states.1.items.6.1 is *not* a dictionary - it's a float, and there's no sensible way to do a for loop over a float. -- Cheers, Simon B.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.