Code

Ticket #17151: 17151.diff

File 17151.diff, 5.3 KB (added by Bradley Ayers <bradley.ayers@…>, 3 years ago)
Line 
1Index: docs/ref/contrib/formtools/form-wizard.txt
2===================================================================
3--- docs/ref/contrib/formtools/form-wizard.txt  (revision 17068)
4+++ docs/ref/contrib/formtools/form-wizard.txt  (working copy)
5@@ -200,8 +200,8 @@
6         {{ wizard.form }}
7     {% endif %}
8     {% if wizard.steps.prev %}
9-    <button name="wizard_prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
10-    <button name="wizard_prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
11+    <button name="wizard_next_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
12+    <button name="wizard_next_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
13     {% endif %}
14     </table>
15     <input type="submit">
16Index: django/contrib/formtools/wizard/views.py
17===================================================================
18--- django/contrib/formtools/wizard/views.py    (revision 17068)
19+++ django/contrib/formtools/wizard/views.py    (working copy)
20@@ -243,12 +243,12 @@
21         wasn't successful), the next step (if the current step was stored
22         successful) or the done view (if no more steps are available)
23         """
24-        # Look for a wizard_prev_step element in the posted data which
25+        # Look for a wizard_next_step element in the posted data which
26         # contains a valid step name. If one was found, render the requested
27-        # form. (This makes stepping back a lot easier).
28-        wizard_prev_step = self.request.POST.get('wizard_prev_step', None)
29-        if wizard_prev_step and wizard_prev_step in self.get_form_list():
30-            self.storage.current_step = wizard_prev_step
31+        # form. (This makes stepping back or forard a lot easier).
32+        next_step = self.request.POST.get('wizard_next_step', None)
33+        if next_step and next_step in self.get_form_list():
34+            self.storage.current_step = next_step
35             form = self.get_form(
36                 data=self.storage.get_step_data(self.steps.current),
37                 files=self.storage.get_step_files(self.steps.current))
38@@ -638,10 +638,10 @@
39         Do a redirect if user presses the prev. step button. The rest of this
40         is super'd from FormWizard.
41         """
42-        prev_step = self.request.POST.get('wizard_prev_step', None)
43-        if prev_step and prev_step in self.get_form_list():
44-            self.storage.current_step = prev_step
45-            return redirect(self.url_name, step=prev_step)
46+        next_step = self.request.POST.get('wizard_next_step', None)
47+        if next_step and next_step in self.get_form_list():
48+            self.storage.current_step = next_step
49+            return redirect(self.url_name, step=next_step)
50         return super(NamedUrlWizardView, self).post(*args, **kwargs)
51 
52     def render_next_step(self, form, **kwargs):
53@@ -683,4 +683,3 @@
54     A NamedUrlFormWizard with pre-configured CookieStorageBackend.
55     """
56     storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
57-
58Index: django/contrib/formtools/tests/wizard/wizardtests/tests.py
59===================================================================
60--- django/contrib/formtools/tests/wizard/wizardtests/tests.py  (revision 17068)
61+++ django/contrib/formtools/tests/wizard/wizardtests/tests.py  (working copy)
62@@ -52,7 +52,7 @@
63         self.assertEqual(response.context['wizard']['steps'].current, 'form2')
64 
65         response = self.client.post(self.wizard_url, {
66-            'wizard_prev_step': response.context['wizard']['steps'].prev})
67+            'wizard_next_step': response.context['wizard']['steps'].prev})
68         self.assertEqual(response.status_code, 200)
69         self.assertEqual(response.context['wizard']['steps'].current, 'form1')
70 
71Index: django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
72===================================================================
73--- django/contrib/formtools/tests/wizard/namedwizardtests/tests.py     (revision 17068)
74+++ django/contrib/formtools/tests/wizard/namedwizardtests/tests.py     (working copy)
75@@ -83,7 +83,7 @@
76         response = self.client.post(
77             reverse(self.wizard_urlname, kwargs={
78                 'step': response.context['wizard']['steps'].current
79-            }), {'wizard_prev_step': response.context['wizard']['steps'].prev})
80+            }), {'wizard_next_step': response.context['wizard']['steps'].prev})
81         response = self.client.get(response['Location'])
82 
83         self.assertEqual(response.status_code, 200)
84Index: django/contrib/formtools/templates/formtools/wizard/wizard_form.html
85===================================================================
86--- django/contrib/formtools/templates/formtools/wizard/wizard_form.html        (revision 17068)
87+++ django/contrib/formtools/templates/formtools/wizard/wizard_form.html        (working copy)
88@@ -11,7 +11,7 @@
89 {% endif %}
90 
91 {% if wizard.steps.prev %}
92-<button name="wizard_prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
93-<button name="wizard_prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
94+<button name="wizard_next_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
95+<button name="wizard_next_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
96 {% endif %}
97 <input type="submit" name="submit" value="{% trans "submit" %}" />