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 25574 "A minor enhancement to ""for"" tag description in the reference" wodny Jacek Bzdak "I would like to propose a minor enhancement to a [https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#for paragraph] which gives an example on using the ""for"" tag with dictionaries: {{{#!django {% for key, value in data.items %} {{ key }}: {{ value }} {% endfor %} }}} Currently it doesn't recall the reader that the lookup order would cause different output if the ""dict"" dictionary contains the ""items"" key than when it doesn't. On the other hand a paragraph about defaultdict on [https://docs.djangoproject.com/en/1.8/ref/templates/language/#variables another page] suggests using dict instead of defaultdict. But while it solves the problem of creating an entry by making a lookup it doesn't solve the problem of ""items"" key within a dictionary. I thought that maybe one or both pages could contain a reminder that the view author should remember not to pass a dictionary with the ""items"" key if the template author wants to use that ""for key, value"" construct." Cleanup/optimization closed Documentation 1.8 Normal fixed for tag lookup order dict defaultdict Accepted 1 0 0 0 1 0