Ticket #17151: 17151.diff

File 17151.diff, 5.3 KB (added by Bradley Ayers <bradley.ayers@…>, 13 years ago)
  • docs/ref/contrib/formtools/form-wizard.txt

     
    200200        {{ wizard.form }}
    201201    {% endif %}
    202202    {% 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>
    205205    {% endif %}
    206206    </table>
    207207    <input type="submit">
  • django/contrib/formtools/wizard/views.py

     
    243243        wasn't successful), the next step (if the current step was stored
    244244        successful) or the done view (if no more steps are available)
    245245        """
    246         # Look for a wizard_prev_step element in the posted data which
     246        # Look for a wizard_next_step element in the posted data which
    247247        # 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_step
     248        # 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
    252252            form = self.get_form(
    253253                data=self.storage.get_step_data(self.steps.current),
    254254                files=self.storage.get_step_files(self.steps.current))
     
    638638        Do a redirect if user presses the prev. step button. The rest of this
    639639        is super'd from FormWizard.
    640640        """
    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        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)
    645645        return super(NamedUrlWizardView, self).post(*args, **kwargs)
    646646
    647647    def render_next_step(self, form, **kwargs):
     
    683683    A NamedUrlFormWizard with pre-configured CookieStorageBackend.
    684684    """
    685685    storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
    686 
  • django/contrib/formtools/tests/wizard/wizardtests/tests.py

     
    5252        self.assertEqual(response.context['wizard']['steps'].current, 'form2')
    5353
    5454        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})
    5656        self.assertEqual(response.status_code, 200)
    5757        self.assertEqual(response.context['wizard']['steps'].current, 'form1')
    5858
  • django/contrib/formtools/tests/wizard/namedwizardtests/tests.py

     
    8383        response = self.client.post(
    8484            reverse(self.wizard_urlname, kwargs={
    8585                'step': response.context['wizard']['steps'].current
    86             }), {'wizard_prev_step': response.context['wizard']['steps'].prev})
     86            }), {'wizard_next_step': response.context['wizard']['steps'].prev})
    8787        response = self.client.get(response['Location'])
    8888
    8989        self.assertEqual(response.status_code, 200)
  • django/contrib/formtools/templates/formtools/wizard/wizard_form.html

     
    1111{% endif %}
    1212
    1313{% 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>
    1616{% endif %}
    1717<input type="submit" name="submit" value="{% trans "submit" %}" />
Back to Top