On 8/23/07, *San* <[EMAIL PROTECTED]> wrote: > > So now, I passed in as dictionary data = { a: a_stuff, b: > b_stuff, ... } > where a_stuff and b_stuff is also a dictionary, a_stuff {a_max:9, > a_min:0, ...... etc} > > when i use > {% for key,value in data.items %} > {{key}}, {{value}} > {%endfor%} > > it doesn't print anything, but when i do
I neglected to mention that the key,value syntax is only in Django trunk, not in 0.96. If you are using an older version of Django, you will need to use {% for item in data.items %} {{ item.0 }} - {{ item.1 }} {%endfor%} > did i pass the data incorrectly or something? In this case, Django is just following the instructions you gave. > it doesn't print anything, but when i do > {% for key in data.items %}{{key}}{%endfor%} The loop here is for key in data.items: data.items returns a list of tuples, so in this loop, each iteration of 'key' will hold a key-value tuple: > it prints : > ('a', {'a_max': 9, 'a_min': 0, .... etc}), Which is exactly what it prints. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---