summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-05-31 08:07:40 -0400
committerTim Graham <timograham@gmail.com>2013-05-31 08:08:42 -0400
commit1c5cccedb46497daf90ff6e8e53d33680efa3b85 (patch)
tree6a5d303e01a073cfc4a9c187826ffad34c7f23cb /docs/ref
parente873de0a5afe30b8ed4bb473d95413410433d6f3 (diff)
[1.5.x] Fixed #20326 - Corrected form wizard get_form() example.
Thanks tris@ for the report. Backport of 646a2216e9 from master
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/formtools/form-wizard.txt11
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 bcffb7716b..349582c19e 100644
--- a/docs/ref/contrib/formtools/form-wizard.txt
+++ b/docs/ref/contrib/formtools/form-wizard.txt
@@ -405,8 +405,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
@@ -418,6 +420,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