Anonymous committed 9eee09a

Use built in django json serializer and allow optional named arguments to be passed through to the serializer

Comments (0)

Files changed (1)


 from django.shortcuts import render_to_response
 from django import forms
+from django.core import serializers
 from django.template import RequestContext
 from django.db.models import signals as signalmodule
 from django.http import HttpResponse
     HttpResponse descendant, which return response with ``application/json`` mimetype.
-    def __init__(self, data):
-        super(JsonResponse, self).__init__(content=simplejson.dumps(data), mimetype='application/json')
+    def __init__(self, data, **kwargs):
+        super(JsonResponse, self).__init__(content=serializers.serialize('json', data, **kwargs), mimetype='application/json')