Author: julien
Date: 2011-12-19 04:28:39 -0800 (Mon, 19 Dec 2011)
New Revision: 17232

Modified:
   django/trunk/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
   django/trunk/django/contrib/formtools/wizard/views.py
Log:
Fixed #17150 -- Made `NamedUrlWizardView.url_name` available in the template 
context. Thanks to Bradley Ayers for the suggestion and to Stephan Jaekel for 
the patch.

Modified: 
django/trunk/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
===================================================================
--- 
django/trunk/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py    
    2011-12-19 12:11:12 UTC (rev 17231)
+++ 
django/trunk/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py    
    2011-12-19 12:28:39 UTC (rev 17232)
@@ -28,7 +28,9 @@
         self.assertEqual(wizard['steps'].prev, None)
         self.assertEqual(wizard['steps'].next, 'form2')
         self.assertEqual(wizard['steps'].count, 4)
+        self.assertEqual(wizard['url_name'], self.wizard_urlname)
 
+
     def test_initial_call_with_params(self):
         get_params = {'getvar1': 'getval1', 'getvar2': 'getval2'}
         response = self.client.get(reverse('%s_start' % self.wizard_urlname),

Modified: django/trunk/django/contrib/formtools/wizard/views.py
===================================================================
--- django/trunk/django/contrib/formtools/wizard/views.py       2011-12-19 
12:11:12 UTC (rev 17231)
+++ django/trunk/django/contrib/formtools/wizard/views.py       2011-12-19 
12:28:39 UTC (rev 17232)
@@ -644,6 +644,15 @@
             return redirect(self.url_name, step=prev_step)
         return super(NamedUrlWizardView, self).post(*args, **kwargs)
 
+    def get_context_data(self, form, **kwargs):
+        """
+        NamedUrlWizardView provides the url_name of this wizard in the context
+        dict `wizard`.
+        """
+        context = super(NamedUrlWizardView, self).get_context_data(form=form, 
**kwargs)
+        context['wizard']['url_name'] = self.url_name
+        return context
+
     def render_next_step(self, form, **kwargs):
         """
         When using the NamedUrlFormWizard, we have to redirect to update the

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to