Merge pull request #466 from kenthauser/ticket_19025

#19025 Add `form` to formwizard context (includes tests)
This commit is contained in:
Jannis Leidel 2012-11-17 12:23:48 -08:00
commit 730977046b
2 changed files with 5 additions and 1 deletions

View File

@ -72,6 +72,10 @@ class WizardTests(object):
self.assertEqual(response.context['wizard']['steps'].current, 'form2') self.assertEqual(response.context['wizard']['steps'].current, 'form2')
self.assertEqual(response.context.get('another_var', None), True) self.assertEqual(response.context.get('another_var', None), True)
# ticket #19025: `form` should be included in context
form = response.context_data['wizard']['form']
self.assertEqual(response.context_data['form'], form)
def test_form_finish(self): def test_form_finish(self):
response = self.client.get(self.wizard_url) response = self.client.get(self.wizard_url)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)

View File

@ -530,7 +530,7 @@ class WizardView(TemplateView):
context.update({'another_var': True}) context.update({'another_var': True})
return context return context
""" """
context = super(WizardView, self).get_context_data(**kwargs) context = super(WizardView, self).get_context_data(form=form, **kwargs)
context.update(self.storage.extra_data) context.update(self.storage.extra_data)
context['wizard'] = { context['wizard'] = {
'form': form, 'form': form,