Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #17151 -- Renamed `wizard_prev_step` to the clearer `wizard_got…

…o_step` in `NamedUrlWizardView`. Thanks, Bradley Ayers and Stephan Jaekel.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ed56e2c4a8f459362ae83cfce03d82193adac6ef 1 parent ad5df51
@jphalip jphalip authored
View
4 django/contrib/formtools/templates/formtools/wizard/wizard_form.html
@@ -12,7 +12,7 @@
{% endif %}
{% if wizard.steps.prev %}
-<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
-<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
+<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
+<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
{% endif %}
<input type="submit" name="submit" value="{% trans "submit" %}" />
View
2  django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
@@ -85,7 +85,7 @@ def test_form_stepback(self):
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)
View
2  django/contrib/formtools/tests/wizard/wizardtests/tests.py
@@ -55,7 +55,7 @@ def test_form_stepback(self):
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')
View
16 django/contrib/formtools/wizard/views.py
@@ -243,12 +243,12 @@ def post(self, *args, **kwargs):
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 @@ def post(self, *args, **kwargs):
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):
View
4 docs/ref/contrib/formtools/form-wizard.txt
@@ -206,8 +206,8 @@ Here's a full example template:
{% endif %}
</table>
{% if wizard.steps.prev %}
- <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
- <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
+ <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
+ <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
{% endif %}
<input type="submit" value="{% trans "submit" %}"/>
</form>
Please sign in to comment.
Something went wrong with that request. Please try again.