From d0bd5330432e1dda519ebd89606bd0980a36dcb4 Mon Sep 17 00:00:00 2001 From: Sambhav Satija Date: Wed, 12 Aug 2015 06:23:26 +0530 Subject: Fixed #25254 -- Added JsonResponse json_dumps_params parameter. --- docs/ref/request-response.txt | 9 ++++++++- docs/releases/1.9.txt | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 86cc4ccbd1..203db54eb0 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -912,7 +912,7 @@ types of HTTP responses. Like ``HttpResponse``, these subclasses live in JsonResponse objects ==================== -.. class:: JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, **kwargs) +.. class:: JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, json_dumps_params=None, **kwargs) An :class:`HttpResponse` subclass that helps to create a JSON-encoded response. It inherits most behavior from its superclass with a couple @@ -934,6 +934,13 @@ JsonResponse objects ``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 ``json_dumps_params`` parameter is a dictionary of keyword arguments + to pass to the ``json.dumps()`` call used to generate the response. + + .. versionchanged:: 1.9 + + The ``json_dumps_params`` argument was added. + Usage ----- diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index f6ff0e6105..be5c3427a1 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -545,6 +545,10 @@ Requests and Responses * Added :meth:`HttpRequest.get_port() ` to fetch the originating port of the request. +* Added the ``json_dumps_params`` parameter to + :class:`~django.http.JsonResponse` to allow passing keyword arguments to the + ``json.dumps()`` call used to generate the response. + Tests ^^^^^ -- cgit v1.3