diff options
| author | Tim Graham <timograham@gmail.com> | 2015-08-12 10:26:59 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-08-12 10:28:43 -0400 |
| commit | 312abecefd795775cb06b08b3eafe3e1f3f1ceef (patch) | |
| tree | baab8b0c99e8e31fd25108405f958a333e44525f /docs/ref/request-response.txt | |
| parent | 77ced0b7408e83cd71348fb8d2495406c074eca1 (diff) | |
[1.8.x] Corrected indentation of JsonResponse docs.
Backport of 290145e6616b32a0b0c63f44b7c09d0a4af7dfd5 from master
Diffstat (limited to 'docs/ref/request-response.txt')
| -rw-r--r-- | docs/ref/request-response.txt | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 4d2e8b4af3..6bc3ed45a0 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -889,29 +889,27 @@ JsonResponse objects .. versionadded:: 1.7 -.. class:: JsonResponse +.. class:: JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, **kwargs) -.. method:: JsonResponse.__init__(data, encoder=DjangoJSONEncoder, safe=True, **kwargs) + An :class:`HttpResponse` subclass that helps to create a JSON-encoded + response. It inherits most behavior from its superclass with a couple + differences: - An :class:`HttpResponse` subclass that helps to create a JSON-encoded - response. It inherits most behavior from its superclass with a couple - differences: + Its default ``Content-Type`` header is set to ``application/json``. - Its default ``Content-Type`` header is set to ``application/json``. + The first parameter, ``data``, should be a ``dict`` instance. If the + ``safe`` parameter is set to ``False`` (see below) it can be any + JSON-serializable object. - The first parameter, ``data``, should be a ``dict`` instance. If the ``safe`` - parameter is set to ``False`` (see below) it can be any JSON-serializable - object. + The ``encoder``, which defaults to + ``django.core.serializers.json.DjangoJSONEncoder``, will be used to + serialize the data. See :ref:`JSON serialization + <serialization-formats-json>` for more details about this serializer. - The ``encoder``, which defaults to - ``django.core.serializers.json.DjangoJSONEncoder``, will be used to - serialize the data. See :ref:`JSON serialization - <serialization-formats-json>` for more details about this serializer. - - The ``safe`` boolean parameter defaults to ``True``. If it's set to ``False``, - any object can be passed for serialization (otherwise only ``dict`` instances - are allowed). If ``safe`` is ``True`` and a non-``dict`` object is passed as - the first argument, a :exc:`TypeError` will be raised. + The ``safe`` boolean parameter defaults to ``True``. If it's set to + ``False``, any object can be passed for serialization (otherwise only + ``dict`` instances are allowed). If ``safe`` is ``True`` and a non-``dict`` + object is passed as the first argument, a :exc:`TypeError` will be raised. Usage ----- |
