On Dec 14, 1:03 am, Steve Freitas <[EMAIL PROTECTED]> wrote:
> Only, it doesn't work. It seems like . lookups
> require the argument to be a literal, not a variable.
Grindizer addresses your specific problem of enumerating key/value
pairs in a template (piece of cake!), but if you still wanted
have you take a look at the django documentation ?
http://www.djangoproject.com/documentation/templates/#for
Because we can see this :)
{% for key, value in data.items %}
{{ key }}: {{ value }}
{% endfor %}
On 14 déc, 08:03, Steve Freitas <[EMAIL PROTECTED]> wrote:
> I have a dictionary,
It seems that you've made a typo. change {{myDict.key}} to {{myDict.keys}}
On Dec 14, 2007 3:03 PM, Steve Freitas <[EMAIL PROTECTED]> wrote:
>
> I have a dictionary, and I'd like to iterate over the keys, using the
> keys to look up the result, like:
>
> {% for key in myDict %}
> The key is
I have a dictionary, and I'd like to iterate over the keys, using the
keys to look up the result, like:
{% for key in myDict %}
The key is {{key}} and the value is {{myDict.key}}.
{% endfor %}
Only, it doesn't work. It seems like . lookups
require the argument to be a literal, not a variable.
4 matches
Mail list logo