#17850: Passing FormWizard.as_view(form_list) a dynamic form_list
-------------------------------------+-------------------------------------
     Reporter:  Jeffrey Horn         |                    Owner:  nobody
  <jrhorn424@…>                      |                   Status:  new
         Type:  Bug                  |                  Version:
    Component:  contrib.formtools    |  1.4-beta-1
     Severity:  Normal               |               Resolution:
     Keywords:  formwizard           |             Triage Stage:
    Has patch:  0                    |  Unreviewed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jrhorn424):

 Yes, no matter what I did, !WizardView was always expecting some kind of
 list. :)

 I'm also not sure if this a bug, but I think dynamic forms is a feature
 worth having.

 Here's what I went with, but the form wizard is still acting weird, not
 giving me a next button when there are multiple steps:

 {{{
 class SurveyWizard(CookieWizardView):

     def dispatch(self, request, *args, **kwargs):
         survey_page_list = get_survey_page_list(kwargs['survey'])
         self.form_list =
 self.get_initkwargs(survey_page_list)['form_list']
         return super(SurveyWizard, self).dispatch(request, *args,
 **kwargs)

     def done(self, form_list, **kwargs):
         # do something
 }}}

 Also, I passed !SurveyWizard.as_view() a list filled with a bogus form to
 avoid the wrong number of arguments error. The form list is overridden by
 dispatch above, anyway.

 Thanks to !SmileyChris on #django for walking me through the source for a
 few hours to figure this out.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17850#comment:4>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to