1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #19076 -- Added content_type attribute to TemplateView.

Thanks Gavin Wahl.
This commit is contained in:
Aymeric Augustin
2013-01-30 21:26:17 +01:00
parent 3f1a0c0040
commit 23e319d729
5 changed files with 32 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ class TemplateResponseMixin(object):
"""
template_name = None
response_class = TemplateResponse
content_type = None
def render_to_response(self, context, **response_kwargs):
"""
@@ -122,6 +123,7 @@ class TemplateResponseMixin(object):
If any keyword arguments are provided, they will be
passed to the constructor of the response class.
"""
response_kwargs.setdefault('content_type', self.content_type)
return self.response_class(
request = self.request,
template = self.get_template_names(),