Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Julien Phalip authored December 19, 2011
4  django/contrib/formtools/templates/formtools/wizard/wizard_form.html
@@ -12,7 +12,7 @@
12 12
 {% endif %}
13 13
 
14 14
 {% if wizard.steps.prev %}
15  
-<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
16  
-<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
  15
+<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
  16
+<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
17 17
 {% endif %}
18 18
 <input type="submit" name="submit" value="{% trans "submit" %}" />
2  django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
@@ -85,7 +85,7 @@ def test_form_stepback(self):
85 85
         response = self.client.post(
86 86
             reverse(self.wizard_urlname, kwargs={
87 87
                 'step': response.context['wizard']['steps'].current
88  
-            }), {'wizard_prev_step': response.context['wizard']['steps'].prev})
  88
+            }), {'wizard_goto_step': response.context['wizard']['steps'].prev})
89 89
         response = self.client.get(response['Location'])
90 90
 
91 91
         self.assertEqual(response.status_code, 200)
2  django/contrib/formtools/tests/wizard/wizardtests/tests.py
@@ -55,7 +55,7 @@ def test_form_stepback(self):
55 55
         self.assertEqual(response.context['wizard']['steps'].current, 'form2')
56 56
 
57 57
         response = self.client.post(self.wizard_url, {
58  
-            'wizard_prev_step': response.context['wizard']['steps'].prev})
  58
+            'wizard_goto_step': response.context['wizard']['steps'].prev})
59 59
         self.assertEqual(response.status_code, 200)
60 60
         self.assertEqual(response.context['wizard']['steps'].current, 'form1')
61 61
 
16  django/contrib/formtools/wizard/views.py
@@ -243,12 +243,12 @@ def post(self, *args, **kwargs):
243 243
         wasn't successful), the next step (if the current step was stored
244 244
         successful) or the done view (if no more steps are available)
245 245
         """
246  
-        # Look for a wizard_prev_step element in the posted data which
  246
+        # Look for a wizard_goto_step element in the posted data which
247 247
         # contains a valid step name. If one was found, render the requested
248 248
         # form. (This makes stepping back a lot easier).
249  
-        wizard_prev_step = self.request.POST.get('wizard_prev_step', None)
250  
-        if wizard_prev_step and wizard_prev_step in self.get_form_list():
251  
-            self.storage.current_step = wizard_prev_step
  249
+        wizard_goto_step = self.request.POST.get('wizard_goto_step', None)
  250
+        if wizard_goto_step and wizard_goto_step in self.get_form_list():
  251
+            self.storage.current_step = wizard_goto_step
252 252
             form = self.get_form(
253 253
                 data=self.storage.get_step_data(self.steps.current),
254 254
                 files=self.storage.get_step_files(self.steps.current))
@@ -638,10 +638,10 @@ def post(self, *args, **kwargs):
638 638
         Do a redirect if user presses the prev. step button. The rest of this
639 639
         is super'd from FormWizard.
640 640
         """
641  
-        prev_step = self.request.POST.get('wizard_prev_step', None)
642  
-        if prev_step and prev_step in self.get_form_list():
643  
-            self.storage.current_step = prev_step
644  
-            return redirect(self.url_name, step=prev_step)
  641
+        wizard_goto_step = self.request.POST.get('wizard_goto_step', None)
  642
+        if wizard_goto_step and wizard_goto_step in self.get_form_list():
  643
+            self.storage.current_step = wizard_goto_step
  644
+            return redirect(self.url_name, step=wizard_goto_step)
645 645
         return super(NamedUrlWizardView, self).post(*args, **kwargs)
646 646
 
647 647
     def get_context_data(self, form, **kwargs):
4  docs/ref/contrib/formtools/form-wizard.txt
@@ -206,8 +206,8 @@ Here's a full example template:
206 206
     {% endif %}
207 207
     </table>
208 208
     {% if wizard.steps.prev %}
209  
-    <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
210  
-    <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
  209
+    <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
  210
+    <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
211 211
     {% endif %}
212 212
     <input type="submit" value="{% trans "submit" %}"/>
213 213
     </form>

0 notes on commit ed56e2c

Please sign in to comment.
Something went wrong with that request. Please try again.