Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from django.utils import simplejson
from django.http import HttpResponse
class JsonResponse(HttpResponse):
"""
JSON response
"""
def __init__(self, content, mimetype='application/json', status=None, content_type=None):
super(JsonResponse, self).__init__(
content=simplejson.dumps(content),
mimetype=mimetype,
status=status,
content_type=content_type,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment