aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/renderers.py
diff options
context:
space:
mode:
authorTom Christie2012-09-03 13:30:20 +0100
committerTom Christie2012-09-03 13:30:20 +0100
commita25b4be4418a2a94e38a77b13cc234ca68e8322c (patch)
tree8b14904314ed87d8f0f15bc2a6ebb30c1cf570b9 /djangorestframework/renderers.py
parentebbaff0853d49cd436b416beeb28220922bfc977 (diff)
downloaddjango-rest-framework-a25b4be4418a2a94e38a77b13cc234ca68e8322c.tar.bz2
Support generators
Diffstat (limited to 'djangorestframework/renderers.py')
-rw-r--r--djangorestframework/renderers.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/djangorestframework/renderers.py b/djangorestframework/renderers.py
index 8d103025..70c0dc88 100644
--- a/djangorestframework/renderers.py
+++ b/djangorestframework/renderers.py
@@ -6,12 +6,12 @@ by serializing the output along with documentation regarding the View, output st
and providing forms and links depending on the allowed methods, renderers and parsers on the View.
"""
from django import forms
-from django.core.serializers.json import DateTimeAwareJSONEncoder
from django.template import RequestContext, loader
from django.utils import simplejson as json
from djangorestframework.compat import yaml
from djangorestframework.utils import dict2xml
+from djangorestframework.utils import encoders
from djangorestframework.utils.breadcrumbs import get_breadcrumbs
from djangorestframework.utils.mediatypes import get_media_type_params, add_media_type_param, media_type_matches
from djangorestframework import VERSION
@@ -94,6 +94,7 @@ class JSONRenderer(BaseRenderer):
media_type = 'application/json'
format = 'json'
+ encoder_class = encoders.JSONEncoder
def render(self, obj=None, media_type=None):
"""
@@ -112,7 +113,7 @@ class JSONRenderer(BaseRenderer):
except (ValueError, TypeError):
indent = None
- return json.dumps(obj, cls=DateTimeAwareJSONEncoder, indent=indent, sort_keys=sort_keys)
+ return json.dumps(obj, cls=self.encoder_class, indent=indent, sort_keys=sort_keys)
class JSONPRenderer(JSONRenderer):