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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user