Skip to content

Instantly share code, notes, and snippets.

@urkh
Forked from philippeowagner/gist:3179eb475fe1795d6515
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urkh/aae596edfa2e33bc7421 to your computer and use it in GitHub Desktop.
Save urkh/aae596edfa2e33bc7421 to your computer and use it in GitHub Desktop.
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