Code

Opened 3 years ago

Closed 22 months 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.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by stephen.smith@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 2 years ago by julien

  • Triage Stage changed from Unreviewed to Accepted

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

comment:3 Changed 22 months ago by Claude Paroz <claude@…>

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

In [c446bdee84efe42f5c0bbfee16986a80c83ec9a2]:

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

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.