Code

Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#18765 closed Bug (needsinfo)

tutorial01 missed step (poll save)

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

Description

When adding choices to the poll it is suggested that the choice can tell you its API:

>>> c = p.choice_set.create(choice_text='Just hacking again', votes=0)

# Choice objects have API access to their related Poll objects.
>>> c.poll
<Poll: What's up?>

But that does not work - you must save the poll after adding the choices before it appears. Just add:

p.save()

In there after the choice_set.create() call.

Attachments (0)

Change History (4)

comment:1 Changed 20 months ago by anonymous

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

That first line should read:
"the choice can tell you its Poll via API:"

comment:2 follow-up: Changed 20 months ago by charettes

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

What do you mean by it doesn't work? Does it trigger an exception? If so please provide a traceback.

Marking as needsinfo until you provide requested information.

comment:3 in reply to: ↑ 2 Changed 20 months ago by anonymous

Replying to charettes:

What do you mean by it doesn't work? Does it trigger an exception? If so please provide a traceback.

Marking as needsinfo until you provide requested information.


I am nearly positive that the first time it returned nothing from the c.poll() call -- that it wasn't associated with its parent poll until after I saved the poll. However upon retrying it appears to have worked perfectly as documented - consider it my mistake, and apologies.

comment:4 Changed 20 months ago by charettes

No problems :)

Thanks for reporting anyway!

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.