Wednesday, August 31, 2011

Re: how to render context like this :

On Wed, Aug 31, 2011 at 11:40 AM, kele <gisxing@gmail.com> wrote:
>
>
> c = Context( {'teams':
>                 {1: ['a', 'b'] , 2:['c', 'd']}
>       } )
>
> i have try like this :
>
>        {% for k in teams %}
>        <li> {{k}} {{k.0}}    # also try teams[k]  ... etc.  but also
> dosent work
>        {% endfor %}
>
> sorry for my noob question , but pls show me how to to this .
>

{% for k,v in teams.items %}
{{ k }}: {{ v.0 }} , {{ v.1 }}
{% endfor %}

Cheers

Tom

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment