diff --git a/django/contrib/formtools/templates/formtools/wizard/wizard_form.html b/django/contrib/formtools/templates/formtools/wizard/wizard_form.html index fe755222ed..95bc576618 100644 --- a/django/contrib/formtools/templates/formtools/wizard/wizard_form.html +++ b/django/contrib/formtools/templates/formtools/wizard/wizard_form.html @@ -12,7 +12,7 @@ {% endif %} {% if wizard.steps.prev %} - - + + {% endif %} diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py index b5ebe90030..87bb5f6e5e 100644 --- a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py +++ b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py @@ -85,7 +85,7 @@ class NamedWizardTests(object): response = self.client.post( reverse(self.wizard_urlname, kwargs={ 'step': response.context['wizard']['steps'].current - }), {'wizard_prev_step': response.context['wizard']['steps'].prev}) + }), {'wizard_goto_step': response.context['wizard']['steps'].prev}) response = self.client.get(response['Location']) self.assertEqual(response.status_code, 200) diff --git a/django/contrib/formtools/tests/wizard/wizardtests/tests.py b/django/contrib/formtools/tests/wizard/wizardtests/tests.py index 3eb77cb648..592065e51a 100644 --- a/django/contrib/formtools/tests/wizard/wizardtests/tests.py +++ b/django/contrib/formtools/tests/wizard/wizardtests/tests.py @@ -55,7 +55,7 @@ class WizardTests(object): self.assertEqual(response.context['wizard']['steps'].current, 'form2') response = self.client.post(self.wizard_url, { - 'wizard_prev_step': response.context['wizard']['steps'].prev}) + 'wizard_goto_step': response.context['wizard']['steps'].prev}) self.assertEqual(response.status_code, 200) self.assertEqual(response.context['wizard']['steps'].current, 'form1') diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py index 85ffc626ba..ac902edbef 100644 --- a/django/contrib/formtools/wizard/views.py +++ b/django/contrib/formtools/wizard/views.py @@ -243,12 +243,12 @@ class WizardView(TemplateView): wasn't successful), the next step (if the current step was stored successful) or the done view (if no more steps are available) """ - # Look for a wizard_prev_step element in the posted data which + # Look for a wizard_goto_step element in the posted data which # contains a valid step name. If one was found, render the requested # form. (This makes stepping back a lot easier). - wizard_prev_step = self.request.POST.get('wizard_prev_step', None) - if wizard_prev_step and wizard_prev_step in self.get_form_list(): - self.storage.current_step = wizard_prev_step + wizard_goto_step = self.request.POST.get('wizard_goto_step', None) + if wizard_goto_step and wizard_goto_step in self.get_form_list(): + self.storage.current_step = wizard_goto_step form = self.get_form( data=self.storage.get_step_data(self.steps.current), files=self.storage.get_step_files(self.steps.current)) @@ -638,10 +638,10 @@ class NamedUrlWizardView(WizardView): Do a redirect if user presses the prev. step button. The rest of this is super'd from FormWizard. """ - prev_step = self.request.POST.get('wizard_prev_step', None) - if prev_step and prev_step in self.get_form_list(): - self.storage.current_step = prev_step - return redirect(self.url_name, step=prev_step) + wizard_goto_step = self.request.POST.get('wizard_goto_step', None) + if wizard_goto_step and wizard_goto_step in self.get_form_list(): + self.storage.current_step = wizard_goto_step + return redirect(self.url_name, step=wizard_goto_step) return super(NamedUrlWizardView, self).post(*args, **kwargs) def get_context_data(self, form, **kwargs): diff --git a/docs/ref/contrib/formtools/form-wizard.txt b/docs/ref/contrib/formtools/form-wizard.txt index 4c071c155f..01f5567706 100644 --- a/docs/ref/contrib/formtools/form-wizard.txt +++ b/docs/ref/contrib/formtools/form-wizard.txt @@ -206,8 +206,8 @@ Here's a full example template: {% endif %} {% if wizard.steps.prev %} - - + + {% endif %}