On Thu, Feb 5, 2009 at 10:21 AM, Carlos Pero <carlos.p...@gmail.com> wrote:
> > Searching this group, I found a number of ways to iterate over a > dictionary in a template to get access to both the key and the value. > However, none of them covered the technique mentioned in this blog > post: > > > http://www.zedkep.com/blog/index.php?/archives/85-Iterating-over-a-dictionary-in-Django-templates.html > > Maybe it's my PHP experience, but the syntax: > > {% for key,value in dictionary.items %}{{ value }}{% endfor %} > > is comforting because i have {{ key }} and {{ value }} available > separately and simply. > > > Though, this single dictionary structure I'm using is just a stopgap. > I think a list of dictionaries like the MUSICIANS example on this page > may be what I really need to pass to my template (to have multiple > values available): > > http://www.djangobook.com/en/beta/chapter04/ > > > > > FYI this is in the official docs: http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#for -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---