#20326: Documentation for form wizard -> get_form()
--------------------------------------+--------------------
     Reporter:  tris@…                |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Documentation         |    Version:  1.4
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 The description for this method mentions that 'If no step is defined, the
 current step will be determined automatically' but the example fails to
 allow for this.

 This is an issue as when validation fails for a step then the method is
 called with step=None and the custom code will not be executed - in my
 case I was filtering ModelChoice fields based on the answers to the
 previous form and was losing my filters.

 The example should be:
 {{{
 def get_form(self, step=None, data=None, files=None):
     form = super(MyWizard, self).get_form(step, data, files)

     if step is None:
         step = self.steps.current

     if step == '1':
         form.user = self.request.user
     return form
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20326>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to