Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.4.x] Fixed #20326 - Corrected form wizard get_form() example.

Thanks tris@ for the report.

Backport of 646a221 from master
  • Loading branch information...
commit c97cc85b748524d2e0d66c770d485ffeded8e950 1 parent 9b5fe02
@timgraham timgraham authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 docs/ref/contrib/formtools/form-wizard.txt
View
11 docs/ref/contrib/formtools/form-wizard.txt
@@ -394,8 +394,10 @@ Advanced ``WizardView`` methods
.. method:: WizardView.get_form(step=None, data=None, files=None)
This method constructs the form for a given ``step``. If no ``step`` is
- defined, the current step will be determined automatically.
- The method gets three arguments:
+ defined, the current step will be determined automatically. If you override
+ ``get_form``, however, you will need to set ``step`` yourself using
+ ``self.steps.current`` as in the example below. The method gets three
+ arguments:
* ``step`` -- The step for which the form instance should be generated.
* ``data`` -- Gets passed to the form's data argument
@@ -407,6 +409,11 @@ Advanced ``WizardView`` methods
def get_form(self, step=None, data=None, files=None):
form = super(MyWizard, self).get_form(step, data, files)
+
+ # determine the step if not given
+ if step is None:
+ step = self.steps.current
+
if step == '1':
form.user = self.request.user
return form
Please sign in to comment.
Something went wrong with that request. Please try again.