3 from django
.http
import HttpResponse
6 class JsonResponse(HttpResponse
):
7 def __init__(self
, object, jsonp_padding
=None):
8 content
= json
.dumps(object, ensure_ascii
=True)
11 content
= "%(func)s(%(obj)s)" % {"func": jsonp_padding
, "obj": content
}
12 content_type
= "application/json-p"
15 content_type
= "application/json"
17 super(JsonResponse
, self
).__init
__(content
, content_type
=content_type
)