diff options
| author | Tim Graham <timograham@gmail.com> | 2013-05-31 08:07:40 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-05-31 08:07:40 -0400 |
| commit | 646a2216e97a581314c9a2598d481b9e954f2e47 (patch) | |
| tree | d638c25d2bc8e7b7a8b9d5af44dca87854c108b7 /docs | |
| parent | f513764e72faf6bd4be1f063d2842cd4e5d76f7d (diff) | |
Fixed #20326 - Corrected form wizard get_form() example.
Thanks tris@ for the report.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/formtools/form-wizard.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/docs/ref/contrib/formtools/form-wizard.txt b/docs/ref/contrib/formtools/form-wizard.txt index f85ae8356d..7795a32c09 100644 --- a/docs/ref/contrib/formtools/form-wizard.txt +++ b/docs/ref/contrib/formtools/form-wizard.txt @@ -420,8 +420,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 @@ -433,6 +435,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 |
