summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2011-12-19 12:28:39 +0000
committerJulien Phalip <jphalip@gmail.com>2011-12-19 12:28:39 +0000
commitad5df5119f1281a6b2329ffd2326be186a0e8fae (patch)
tree815abe09ecfb24613909375f5ef24b86bec6cf7a
parent3e790ae63266bee48ad659ddedc792219ee33a0e (diff)
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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/formtools/tests/wizard/namedwizardtests/tests.py2
-rw-r--r--django/contrib/formtools/wizard/views.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
index 0f63882b01..b5ebe90030 100644
--- a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
+++ b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
@@ -28,6 +28,8 @@ class NamedWizardTests(object):
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'}
diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
index 0e1486c0fa..85ffc626ba 100644
--- a/django/contrib/formtools/wizard/views.py
+++ b/django/contrib/formtools/wizard/views.py
@@ -644,6 +644,15 @@ class NamedUrlWizardView(WizardView):
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