On Apr 15, 8:26 pm, xpanta <xpa...@gmail.com> wrote: > I have this template problem. > > Although {{ myDictionary.1 }} works, if I write > {{ myDictionary.user.id }} it does not. It prints nothing, actually. > (user comes from a {% for user in Users %} loop. > > user.id is 1 at the first iteration (I have checked it). > > Why? What am I doing wroing? > > Thanks, > Chris
You can't do lookups like that in the template language. {{ myDictionary.user }} will always be treated as the equivalent of the Python code myDictionary["user"], ie using the literal key 'user' not the value that the variable contains. You'll need a custom template tag or filter to do the lookup. -- DR. -- 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.