Ticket #17150: trac-17150.diff

File trac-17150.diff, 1.6 KB (added by steph, 8 years ago)
  • django/contrib/formtools/tests/wizard/namedwizardtests/tests.py

    diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
    index 0f63882..b5ebe90 100644
    a b class NamedWizardTests(object): 
    2828        self.assertEqual(wizard['steps'].prev, None)
    2929        self.assertEqual(wizard['steps'].next, 'form2')
    3030        self.assertEqual(wizard['steps'].count, 4)
     31        self.assertEqual(wizard['url_name'], self.wizard_urlname)
     32
    3133
    3234    def test_initial_call_with_params(self):
    3335        get_params = {'getvar1': 'getval1', 'getvar2': 'getval2'}
  • django/contrib/formtools/wizard/views.py

    diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
    index 15ba146..a0a2f04 100644
    a b class NamedUrlWizardView(WizardView): 
    644644            return redirect(self.url_name, step=prev_step)
    645645        return super(NamedUrlWizardView, self).post(*args, **kwargs)
    646646
     647    def get_context_data(self, form, **kwargs):
     648        """
     649        NamedUrlWizardView provides the url_name of this wizard in the context
     650        dict `wizard`.
     651        """
     652        context = super(NamedUrlWizardView, self).get_context_data(form=form, **kwargs)
     653        context['wizard']['url_name'] = self.url_name
     654        return context
     655
    647656    def render_next_step(self, form, **kwargs):
    648657        """
    649658        When using the NamedUrlFormWizard, we have to redirect to update the
Back to Top