Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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)

19880.diff (879 bytes ) - added by Tim Graham 12 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Carl Meyer, 12 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Carl Meyer, 12 years ago

#19886 was a duplicate.

comment:4 by expleo, 12 years ago

Has patch: set

comment:5 by Tim Graham, 12 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.

in reply to:  5 comment:6 by expleo, 12 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 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.

I agree, not changing the docs seems the best option in this case.

by Tim Graham, 12 years ago

Attachment: 19880.diff added

comment:7 by Tim Graham, 12 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 Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In a97c441e18684570fbecd47b19bd47b4c06cc565:

[1.5.X] Fixed #19880 - Fixed an error in the form wizard initial_dict example.

Thanks almalki for the report.

Backport of 9b97f01dea from master

comment:9 by Tim Graham <timograham@…>, 12 years ago

In 9b97f01dea093de484366924842c89550472d0b6:

Fixed #19880 - Fixed an error in the form wizard initial_dict example.

Thanks almalki for the report.

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