Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17150 -- Made `NamedUrlWizardView.url_name` available in the t…

…emplate context. Thanks to Bradley Ayers for the suggestion and to Stephan Jaekel for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ad5df5119f1281a6b2329ffd2326be186a0e8fae 1 parent 3e790ae
Julien Phalip authored
2  django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
@@ -28,6 +28,8 @@ def test_initial_call(self):
28 28
         self.assertEqual(wizard['steps'].prev, None)
29 29
         self.assertEqual(wizard['steps'].next, 'form2')
30 30
         self.assertEqual(wizard['steps'].count, 4)
  31
+        self.assertEqual(wizard['url_name'], self.wizard_urlname)
  32
+
31 33
 
32 34
     def test_initial_call_with_params(self):
33 35
         get_params = {'getvar1': 'getval1', 'getvar2': 'getval2'}
9  django/contrib/formtools/wizard/views.py
@@ -644,6 +644,15 @@ def post(self, *args, **kwargs):
644 644
             return redirect(self.url_name, step=prev_step)
645 645
         return super(NamedUrlWizardView, self).post(*args, **kwargs)
646 646
 
  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
+
647 656
     def render_next_step(self, form, **kwargs):
648 657
         """
649 658
         When using the NamedUrlFormWizard, we have to redirect to update the

0 notes on commit ad5df51

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