#18765 closed Bug (needsinfo)
tutorial01 missed step (poll save)
Reported by: | 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.
Change History (4)
comment:1 by , 12 years ago
follow-up: 3 comment:2 by , 12 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → 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 by , 12 years ago
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.
That first line should read:
"the choice can tell you its Poll via API:"