'for' statements with five words should end in 'reversed': for key, value in obj.items

311 views
Skip to first unread message

Salim Fadhley

unread,
Apr 18, 2008, 6:33:13 AM4/18/08
to Django users
When rendering this template:

{% block objcontent %}
{% for key, value in obj.items %}
<tr>
<td>{{ key }}
</td>
<td>{{ repr(value) }}
</td>
</tr>
{% endfor %}
{% endblock objcontent %}

I get this error:

'for' statements with five words should end in 'reversed': for key,
value in obj.items

Any idea what is going on here?

I get the same error from:
{% for ( key, value ) in obj.items() %}

Thanls

Dan Ellis

unread,
Apr 18, 2008, 7:02:33 AM4/18/08
to Django users
You can't do "key, value" in Django 0.96. You need to do "for item in
obj.items" and then use item.0 and item.1, or use a development
version.

Salim Fadhley

unread,
Apr 18, 2008, 8:13:59 AM4/18/08
to Django users
Great - I upgraded to dev - it works fine.
Reply all
Reply to author
Forward
0 new messages