Fixed #10190 -- Made HttpResponse charset customizable.

Thanks to Simon Charette, Aymeric Augustin, and Tim Graham
for reviews and contributions.
This commit is contained in:
Unai Zalakain 2013-11-16 18:54:12 +01:00 committed by Tim Graham
parent 9d6551204e
commit 5f2542f12a
7 changed files with 125 additions and 18 deletions

View file

@ -56,7 +56,7 @@ Attributes
Methods
-------
.. method:: SimpleTemplateResponse.__init__(template, context=None, content_type=None, status=None)
.. method:: SimpleTemplateResponse.__init__(template, context=None, content_type=None, status=None, charset=None)
Instantiates a
:class:`~django.template.response.SimpleTemplateResponse` object
@ -80,6 +80,15 @@ Methods
``content_type`` is specified, then its value is used. Otherwise,
:setting:`DEFAULT_CONTENT_TYPE` is used.
``charset``
The charset in which the response will be encoded. If not given it will
be extracted from ``content_type``, and if that is unsuccessful, the
:setting:`DEFAULT_CHARSET` setting will be used.
.. versionadded:: 1.8
The ``charset`` parameter was added.
.. method:: SimpleTemplateResponse.resolve_context(context)
Converts context data into a context instance that can be used for
@ -140,7 +149,7 @@ TemplateResponse objects
Methods
-------
.. method:: TemplateResponse.__init__(request, template, context=None, content_type=None, status=None, current_app=None)
.. method:: TemplateResponse.__init__(request, template, context=None, content_type=None, status=None, current_app=None, charset=None)
Instantiates an ``TemplateResponse`` object with the given
template, context, MIME type and HTTP status.
@ -173,6 +182,14 @@ Methods
:ref:`namespaced URL resolution strategy <topics-http-reversing-url-namespaces>`
for more information.
``charset``
The charset in which the response will be encoded. If not given it will
be extracted from ``content_type``, and if that is unsuccessful, the
:setting:`DEFAULT_CHARSET` setting will be used.
.. versionadded:: 1.8
The ``charset`` parameter was added.
The rendering process
=====================