Code

#18693 closed Uncategorized (invalid)

Minor bug in tutorial part 3

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

Description

Brand new to Django and I'm going through your excellent tutorial, and unless I missed a step there is a small bug in the code in part 3 of the tutorial here:
https://docs.djangoproject.com/en/1.4/intro/tutorial03/

Specifically, this chunk under the heading "Use the template system":

<h1>{{ poll.question }}</h1>
<ul>
{% for choice in poll.choice_set.all %}
    <li>{{ choice.choice }}</li>
{% endfor %}
</ul>

Unless I'm mistaken in the loop it should be choice.choice_text instead of choice.choice. When I changed it to choice.choice_text the choice text appeared in the output.

Attachments (0)

Change History (2)

comment:1 Changed 21 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 21 months ago by timo

  • Resolution set to invalid
  • Status changed from new to closed

Actually, this looks correct to me. On the 1.4 branch the Choice model is declared with a "choice" field while it was changed to "choice_text" in the dev branch (1.5). Perhaps you started on the dev branch for step 1 of the tutorial and ended up on the 1.4 branch for step 3?

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.