#19880 closed Bug (fixed)
form-wizard initial data example is wrong
| Reported by: | almalki | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | form-wizard formwizard wizard |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
In this example there is a small error, basically it is calling as_view and then call methods on the returned function.
>>> wiz = ContactWizard.as_view([ContactForm1, ContactForm2], initial_dict=initial)
>>> form1 = wiz.get_form('0')
should be:
>>> wiz = ContactWizard([ContactForm1, ContactForm2], initial_dict=initial)
>>> form1 = wiz.get_form('0')
(assuming __init__ takes same arguments as as_view)
Attachments (1)
Change History (10)
comment:1 by , 13 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 13 years ago
comment:4 by , 13 years ago
| Has patch: | set |
|---|
follow-up: 6 comment:5 by , 13 years ago
| Has patch: | unset |
|---|
Whoops, I had meant to comment on this but I left the comment on the duplicate ticket instead.
You can't initialize ContactWizard directly with a list of forms and the initial dict. The as_view call is correct, but then you need to pass request to the function that's returned. Maybe RequestFactory could be used for the example, but a session is also needed on the request so it seems a bit complicated to have this example use the shell.
comment:6 by , 13 years ago
Replying to timo:
Whoops, I had meant to comment on this but I left the comment on the duplicate ticket instead.
You can't initialize
ContactWizarddirectly with a list of forms and the initial dict. Theas_viewcall is correct, but then you need to passrequestto the function that's returned. MaybeRequestFactorycould be used for the example, but a session is also needed on the request so it seems a bit complicated to have this example use the shell.
I agree, not changing the docs seems the best option in this case.
by , 13 years ago
| Attachment: | 19880.diff added |
|---|
comment:7 by , 13 years ago
| Has patch: | set |
|---|
I think we should make some sort of fix since it's misleading as is. How about the attached?
comment:8 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
#19886 was a duplicate.