#19886: documentation: FormWizard.as_view() does not have the attribute 
get_form()
-------------------------------+--------------------
     Reporter:  gandalf013@…   |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Documentation  |    Version:  master
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 The [https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-
 wizard/#providing-initial-data-for-the-forms documentation] for form
 wizards has this example:

 {{{
 >>> from myapp.forms import ContactForm1, ContactForm2
 >>> from myapp.views import ContactWizard
 >>> initial = {
 ...     '0': {'subject': 'Hello', 'sender': '[email protected]'},
 ...     '1': {'message': 'Hi there!'}
 ... }
 >>> wiz = ContactWizard.as_view([ContactForm1, ContactForm2],
 initial_dict=initial)
 >>> form1 = wiz.get_form('0')
 >>> form2 = wiz.get_form('1')
 >>> form1.initial
 {'sender': '[email protected]', 'subject': 'Hello'}
 >>> form2.initial
 {'message': 'Hi there!'}
 }}}

 The above example (with the definitions of `ContactForm1`, `ContactForm2`,
 and `ContactWizard` from earlier) fails:

 {{{
 AttributeError: 'function' object has no attribute 'get_form'
 }}}

 It seems like the example assumes that `as_view()` should return an
 instance of `ContactWizard`, whereas it actually returns a function.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19886>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to