Opened 13 years ago

Closed 12 years ago

#17024 closed Cleanup/optimization (fixed)

missing import Choice line in tutorial02

Reported by: stephen.smith@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In Part 2 of the online tutorial (tutorial02) when you get to the section to inline the Choice model, the example code does not mention that you need to add the following line:

from polls.models import Choice

to admin.py and without that line you get an error upon refreshing the admin page. This should be added in the sample code that immediately follows this line in the text:

Remove the register() call for the Choice model. Then, edit the Poll registration code to read:

This might seem intuitive enough to a python expert (to add the above line) but a beginner will get an error and possibly be stuck if they follow the tutorial instructions word for word.

Change History (3)

comment:1 by stephen.smith@…, 13 years ago

Sorry, noticed that it is mentioned in the previous section. The problem is that I sensed in the tutorial that the first way of adding the Choice model was going to be the "not" recommended way to add it so I skipped following that section and jumped to the second "more" recommended way to add the Choice model. In doing so, I missed the import statement mentioned previously. I suspect that most will follow along and not experience the error I reported, but maybe for clarity the "from polls.models import Choice" line could be added to the code snippet mentioned at the location above in this ticket's description.

  • Stephen

comment:2 by Julien Phalip, 13 years ago

Triage Stage: UnreviewedAccepted

This makes sense and it can't hurt to mention the import statement again. Could you provide a patch for this?

comment:3 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In [c446bdee84efe42f5c0bbfee16986a80c83ec9a2]:

Fixed #17024 -- Added import statements in tutorial code sample

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