diff --git a/django/views/generic/dates.py b/django/views/generic/dates.py
index 5f5f959..d0a073b 100644
a
|
b
|
class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
171 | 171 | def get(self, request, *args, **kwargs): |
172 | 172 | self.date_list, self.object_list, extra_context = self.get_dated_items() |
173 | 173 | context = self.get_context_data(object_list=self.object_list, |
174 | | date_list=self.date_list) |
| 174 | date_list=self.date_list, **kwargs) |
175 | 175 | context.update(extra_context) |
176 | 176 | return self.render_to_response(context) |
177 | 177 | |
diff --git a/django/views/generic/detail.py b/django/views/generic/detail.py
index b9278bb..fe8460a 100644
a
|
b
|
class SingleObjectMixin(object):
|
96 | 96 | class BaseDetailView(SingleObjectMixin, View): |
97 | 97 | def get(self, request, *args, **kwargs): |
98 | 98 | self.object = self.get_object() |
99 | | context = self.get_context_data(object=self.object) |
| 99 | context = self.get_context_data(object=self.object, **kwargs) |
100 | 100 | return self.render_to_response(context) |
101 | 101 | |
102 | 102 | |
diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py
index 3cade52..50f600d 100644
a
|
b
|
class ProcessFormView(View):
|
129 | 129 | def get(self, request, *args, **kwargs): |
130 | 130 | form_class = self.get_form_class() |
131 | 131 | form = self.get_form(form_class) |
132 | | return self.render_to_response(self.get_context_data(form=form)) |
| 132 | kwargs['form'] = form |
| 133 | return self.render_to_response(self.get_context_data(**kwargs)) |
133 | 134 | |
134 | 135 | def post(self, request, *args, **kwargs): |
135 | 136 | form_class = self.get_form_class() |
diff --git a/django/views/generic/list.py b/django/views/generic/list.py
index 9797356..63f2808 100644
a
|
b
|
class BaseListView(MultipleObjectMixin, View):
|
116 | 116 | if not allow_empty and len(self.object_list) == 0: |
117 | 117 | raise Http404(_(u"Empty list and '%(class_name)s.allow_empty' is False.") |
118 | 118 | % {'class_name': self.__class__.__name__}) |
119 | | context = self.get_context_data(object_list=self.object_list) |
| 119 | context = self.get_context_data(object_list=self.object_list, **kwargs) |
120 | 120 | return self.render_to_response(context) |
121 | 121 | |
122 | 122 | |
diff --git a/tests/regressiontests/generic_views/edit.py b/tests/regressiontests/generic_views/edit.py
index 182615a..d92bc99 100644
a
|
b
|
class ModelFormMixinTests(TestCase):
|
15 | 15 | form_class = views.AuthorGetQuerySetFormView().get_form_class() |
16 | 16 | self.assertEqual(form_class._meta.model, Author) |
17 | 17 | |
| 18 | |
18 | 19 | class CreateViewTests(TestCase): |
19 | 20 | urls = 'regressiontests.generic_views.urls' |
20 | 21 | |
… |
… |
class CreateViewTests(TestCase):
|
78 | 79 | self.assertRedirects(res, reverse('author_detail', kwargs={'pk': obj.pk})) |
79 | 80 | self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe>']) |
80 | 81 | |
| 82 | def test_regression_t17795(self): |
| 83 | res = self.client.get('/edit/authors/create/special/t17795/') |
| 84 | self.assertEqual(res.status_code, 200) |
| 85 | self.assertIn('key', res.context, msg='key from get_context_data is expected') |
| 86 | self.assertIn('new_key', res.context, msg='new_key from get is expected') |
| 87 | |
81 | 88 | def test_create_without_redirect(self): |
82 | 89 | try: |
83 | 90 | res = self.client.post('/edit/authors/create/naive/', |
… |
… |
class CreateViewTests(TestCase):
|
92 | 99 | self.assertEqual(res.status_code, 302) |
93 | 100 | self.assertRedirects(res, 'http://testserver/accounts/login/?next=/edit/authors/create/restricted/') |
94 | 101 | |
| 102 | |
95 | 103 | class UpdateViewTests(TestCase): |
96 | 104 | urls = 'regressiontests.generic_views.urls' |
97 | 105 | |
… |
… |
class UpdateViewTests(TestCase):
|
224 | 232 | self.assertRedirects(res, 'http://testserver/list/authors/') |
225 | 233 | self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe (xkcd)>']) |
226 | 234 | |
| 235 | |
227 | 236 | class DeleteViewTests(TestCase): |
228 | 237 | urls = 'regressiontests.generic_views.urls' |
229 | 238 | |
diff --git a/tests/regressiontests/generic_views/urls.py b/tests/regressiontests/generic_views/urls.py
index 090ec73..355f568 100644
a
|
b
|
urlpatterns = patterns('',
|
71 | 71 | views.AuthorCreate.as_view()), |
72 | 72 | (r'^edit/authors/create/special/$', |
73 | 73 | views.SpecializedAuthorCreate.as_view()), |
| 74 | (r'^edit/authors/create/special/t17795/$', |
| 75 | views.CreateView_t17795.as_view()), |
74 | 76 | |
75 | 77 | (r'^edit/author/(?P<pk>\d+)/update/naive/$', |
76 | 78 | views.NaiveAuthorUpdate.as_view()), |
diff --git a/tests/regressiontests/generic_views/views.py b/tests/regressiontests/generic_views/views.py
index 5ff9cf0..5284d57 100644
a
|
b
|
class BookDetailGetObjectCustomQueryset(BookDetail):
|
184 | 184 | def get_object(self, queryset=None): |
185 | 185 | return super(BookDetailGetObjectCustomQueryset,self).get_object( |
186 | 186 | queryset=Book.objects.filter(pk=2)) |
| 187 | |
| 188 | |
| 189 | class CreateView_t17795(generic.CreateView): |
| 190 | model = Author |
| 191 | form_class = AuthorForm |
| 192 | template_name = 'generic_views/form.html' |
| 193 | context_object_name = 'thingy' |
| 194 | |
| 195 | def get_success_url(self): |
| 196 | return reverse('author_detail', args=[self.object.id,]) |
| 197 | |
| 198 | def get_context_data(self, **kwargs): |
| 199 | kwargs.update({'key': 'value'}) |
| 200 | return super(CreateView_t17795, self).get_context_data(**kwargs) |
| 201 | |
| 202 | def get(self, request, *args, **kwargs): |
| 203 | kwargs.update({'new_key': 'new value'}) |
| 204 | return super(CreateView_t17795, self).get(request, *args, **kwargs) |