Commit da1db34a by Tom Christie

Handle UUID objects in JSONEncoder. Closes #2433.

parent b3a0a279
......@@ -12,6 +12,7 @@ import datetime
import decimal
import types
import json
import uuid
class JSONEncoder(json.JSONEncoder):
......@@ -45,6 +46,8 @@ class JSONEncoder(json.JSONEncoder):
elif isinstance(obj, decimal.Decimal):
# Serializers will coerce decimals to strings by default.
return float(obj)
elif isinstance(obj, uuid.UUID):
return six.text_type(obj)
elif isinstance(obj, QuerySet):
return tuple(obj)
elif hasattr(obj, 'tolist'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment