[1.8.x] Corrected indentation of JsonResponse docs.
Backport of 290145e661
from master
This commit is contained in:
parent
77ced0b740
commit
312abecefd
|
@ -889,9 +889,7 @@ JsonResponse objects
|
||||||
|
|
||||||
.. versionadded:: 1.7
|
.. 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
|
An :class:`HttpResponse` subclass that helps to create a JSON-encoded
|
||||||
response. It inherits most behavior from its superclass with a couple
|
response. It inherits most behavior from its superclass with a couple
|
||||||
|
@ -899,19 +897,19 @@ JsonResponse objects
|
||||||
|
|
||||||
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``
|
The first parameter, ``data``, should be a ``dict`` instance. If the
|
||||||
parameter is set to ``False`` (see below) it can be any JSON-serializable
|
``safe`` parameter is set to ``False`` (see below) it can be any
|
||||||
object.
|
JSON-serializable object.
|
||||||
|
|
||||||
The ``encoder``, which defaults to
|
The ``encoder``, which defaults to
|
||||||
``django.core.serializers.json.DjangoJSONEncoder``, will be used to
|
``django.core.serializers.json.DjangoJSONEncoder``, will be used to
|
||||||
serialize the data. See :ref:`JSON serialization
|
serialize the data. See :ref:`JSON serialization
|
||||||
<serialization-formats-json>` for more details about this serializer.
|
<serialization-formats-json>` for more details about this serializer.
|
||||||
|
|
||||||
The ``safe`` boolean parameter defaults to ``True``. If it's set to ``False``,
|
The ``safe`` boolean parameter defaults to ``True``. If it's set to
|
||||||
any object can be passed for serialization (otherwise only ``dict`` instances
|
``False``, any object can be passed for serialization (otherwise only
|
||||||
are allowed). If ``safe`` is ``True`` and a non-``dict`` object is passed as
|
``dict`` instances are allowed). If ``safe`` is ``True`` and a non-``dict``
|
||||||
the first argument, a :exc:`TypeError` will be raised.
|
object is passed as the first argument, a :exc:`TypeError` will be raised.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
Loading…
Reference in New Issue