Opened 4 years ago

Closed 4 years ago

#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


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:

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

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

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.

Change History (2)

comment:1 Changed 4 years ago by Tim Graham

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by Tim Graham

Resolution: invalid
Status: newclosed

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?

Note: See TracTickets for help on using tickets.
Back to Top