﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7373	for key, value in some_dict does not work	whoozle	nobody	"I have the following code in my template: 
{{{
{% if form.has_errors %}
errors: <ol> {% for field, error in form.error_dict %}<li>{{ field }} <p><strong>{{ error }}</strong></p></li>{% endfor %}</ol>
{% endif %}
}}}
That stuff does not properly work as I believe it has to: all rows contains 'p' as 'field' and 'u' as 'error'. 
Here's the patch: 
{{{
Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py      (revision 7574)
+++ django/template/defaulttags.py      (working copy)
@@ -138,13 +138,14 @@
             # Boolean values designating first and last times through loop.
             loop_dict['first'] = (i == 0)
             loop_dict['last'] = (i == len_values - 1)
+
+            context[self.loopvars[0]] = item

             if unpack:
                 # If there are multiple loop variables, unpack the item into
                 # them.
-                context.update(dict(zip(self.loopvars, item)))
-            else:
-                context[self.loopvars[0]] = item
+                context[self.loopvars[1]] = values[item][0]
+
             for node in self.nodelist_loop:
                 nodelist.append(node.render(context))
             if unpack:

}}}"		closed	Template system	dev		invalid			Unreviewed	1	0	0	0	0	0
