def test_get_context_data_inheritance(self):
class TestWizard(CookieWizardView):
"""
A subclass that implements ``get_context_data`` using the standard
protocol for generic views (accept only **kwargs).
See ticket #17148.
"""
def get_context_data(self, **kwargs):
context = super(TestWizard, self).get_context_data(**kwargs)
context['test_key'] = 'test_value'
return context
factory = RequestFactory()
view = TestWizard.as_view([forms.Form])
response = view(factory.get('/'))
self.assertEqual(response.context_data['test_key'], 'test_value')
评论列表
文章目录