Code

Opened 5 years ago

Closed 5 years ago

#11238 closed (invalid)

Widespread {% for %} confusion

Reported by: RantyDave Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I currently get about fourty hits a day to this page - http://www.zedkep.com/blog/index.php?/archives/85-Iterating-over-a-dictionary-in-Django-templates.html. While I'm more than happy to help out the community and my ego appreciates the hits, I do think the world as a whole would be better served by fixing the root problem in the documentation.

So here is it: people don't know how to iterate over dictionaries and merely including

{% for key,value in dictionary.items %}{{ value }}{% endfor %}

as an example would probably fix that. Can this be backported to the 1.0 (and 0.96) docs too? Thanks, Dave.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by gwilson

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

There is an example in the docs, check out the third code example here:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for

Looks like this has been in the docs since June 2007, see [5443].

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.