Ticket #17151: 17151.diff
File 17151.diff, 5.3 KB (added by , 13 years ago) |
---|
-
docs/ref/contrib/formtools/form-wizard.txt
200 200 {{ wizard.form }} 201 201 {% endif %} 202 202 {% if wizard.steps.prev %} 203 <button name="wizard_ prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>204 <button name="wizard_ prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>203 <button name="wizard_next_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button> 204 <button name="wizard_next_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button> 205 205 {% endif %} 206 206 </table> 207 207 <input type="submit"> -
django/contrib/formtools/wizard/views.py
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 which246 # Look for a wizard_next_step element in the posted data which 247 247 # contains a valid step name. If one was found, render the requested 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_step248 # form. (This makes stepping back or forard a lot easier). 249 next_step = self.request.POST.get('wizard_next_step', None) 250 if next_step and next_step in self.get_form_list(): 251 self.storage.current_step = next_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 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_step644 return redirect(self.url_name, step= prev_step)641 next_step = self.request.POST.get('wizard_next_step', None) 642 if next_step and next_step in self.get_form_list(): 643 self.storage.current_step = next_step 644 return redirect(self.url_name, step=next_step) 645 645 return super(NamedUrlWizardView, self).post(*args, **kwargs) 646 646 647 647 def render_next_step(self, form, **kwargs): … … 683 683 A NamedUrlFormWizard with pre-configured CookieStorageBackend. 684 684 """ 685 685 storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' 686 -
django/contrib/formtools/tests/wizard/wizardtests/tests.py
52 52 self.assertEqual(response.context['wizard']['steps'].current, 'form2') 53 53 54 54 response = self.client.post(self.wizard_url, { 55 'wizard_ prev_step': response.context['wizard']['steps'].prev})55 'wizard_next_step': response.context['wizard']['steps'].prev}) 56 56 self.assertEqual(response.status_code, 200) 57 57 self.assertEqual(response.context['wizard']['steps'].current, 'form1') 58 58 -
django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
83 83 response = self.client.post( 84 84 reverse(self.wizard_urlname, kwargs={ 85 85 'step': response.context['wizard']['steps'].current 86 }), {'wizard_ prev_step': response.context['wizard']['steps'].prev})86 }), {'wizard_next_step': response.context['wizard']['steps'].prev}) 87 87 response = self.client.get(response['Location']) 88 88 89 89 self.assertEqual(response.status_code, 200) -
django/contrib/formtools/templates/formtools/wizard/wizard_form.html
11 11 {% endif %} 12 12 13 13 {% if wizard.steps.prev %} 14 <button name="wizard_ prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>15 <button name="wizard_ prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>14 <button name="wizard_next_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button> 15 <button name="wizard_next_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button> 16 16 {% endif %} 17 17 <input type="submit" name="submit" value="{% trans "submit" %}" />