1. csunwold
  2. django-annoying

Commits

csunwold  committed 9eee09a

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

  • Participants
  • Parent commits a0de8b2
  • Branches default

Comments (0)

Files changed (1)

File annoying/decorators.py

View file
  • Ignore whitespace
 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')