diff --git a/django/shortcuts/__init__.py b/django/shortcuts/__init__.py
index 9f97cae..5f527aa 100644
a
|
b
|
def render_to_response(*args, **kwargs):
|
16 | 16 | Returns a HttpResponse whose content is filled with the result of calling |
17 | 17 | django.template.loader.render_to_string() with the passed arguments. |
18 | 18 | """ |
19 | | httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)} |
| 19 | httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None), |
| 20 | 'content_type': kwargs.pop('content_type', None)} |
20 | 21 | return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) |
21 | 22 | |
22 | 23 | def render(request, *args, **kwargs): |
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index 9c05c6e..903c995 100644
a
|
b
|
Optional arguments
|
127 | 127 | The MIME type to use for the resulting document. Defaults to the value of |
128 | 128 | the :setting:`DEFAULT_CONTENT_TYPE` setting. |
129 | 129 | |
| 130 | ``content_type`` |
| 131 | |
| 132 | .. versionadded:: 1.4 |
| 133 | |
| 134 | An alias for ``mimetype`` that corresponds more closely to the HTTP header |
| 135 | Content-Type. |
| 136 | |
130 | 137 | Example |
131 | 138 | ------- |
132 | 139 | |
diff --git a/tests/regressiontests/views/generic_urls.py b/tests/regressiontests/views/generic_urls.py
index 40a6c01..2847a7b 100644
a
|
b
|
urlpatterns += patterns('regressiontests.views.views',
|
100 | 100 | (r'^shortcuts/render_to_response/$', 'render_to_response_view'), |
101 | 101 | (r'^shortcuts/render_to_response/request_context/$', 'render_to_response_view_with_request_context'), |
102 | 102 | (r'^shortcuts/render_to_response/mimetype/$', 'render_to_response_view_with_mimetype'), |
| 103 | (r'^shortcuts/render_to_response/content_type/$', 'render_to_response_view_with_content_type'), |
103 | 104 | (r'^shortcuts/render/$', 'render_view'), |
104 | 105 | (r'^shortcuts/render/base_context/$', 'render_view_with_base_context'), |
105 | 106 | (r'^shortcuts/render/content_type/$', 'render_view_with_content_type'), |
diff --git a/tests/regressiontests/views/tests/shortcuts.py b/tests/regressiontests/views/tests/shortcuts.py
index 24bf6bb..1ad6cd5 100644
a
|
b
|
class ShortcutTests(TestCase):
|
44 | 44 | self.assertEqual(response.content, 'FOO.BAR..\n') |
45 | 45 | self.assertEqual(response['Content-Type'], 'application/x-rendertest') |
46 | 46 | |
| 47 | def test_render_to_response_with_contenttype(self): |
| 48 | response = self.client.get('/shortcuts/render_to_response/content_type/') |
| 49 | self.assertEqual(response.status_code, 200) |
| 50 | self.assertEqual(response.content, 'FOO.BAR..\n') |
| 51 | self.assertEqual(response['Content-Type'], 'application/x-rendertest') |
| 52 | |
47 | 53 | def test_render(self): |
48 | 54 | response = self.client.get('/shortcuts/render/') |
49 | 55 | self.assertEqual(response.status_code, 200) |
diff --git a/tests/regressiontests/views/views.py b/tests/regressiontests/views/views.py
index f2b4e79..468bd96 100644
a
|
b
|
def render_to_response_view_with_mimetype(request):
|
91 | 91 | 'bar': 'BAR', |
92 | 92 | }, mimetype='application/x-rendertest') |
93 | 93 | |
| 94 | def render_to_response_view_with_content_type(request): |
| 95 | return render_to_response('debug/render_test.html', { |
| 96 | 'foo': 'FOO', |
| 97 | 'bar': 'BAR', |
| 98 | }, content_type='application/x-rendertest') |
| 99 | |
94 | 100 | def render_view(request): |
95 | 101 | return render(request, 'debug/render_test.html', { |
96 | 102 | 'foo': 'FOO', |