mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-06 13:23:18 +03:00
Update encoders.py
This commit is contained in:
parent
e454758fb6
commit
963302d6f7
|
@ -41,8 +41,7 @@ class JSONEncoder(json.JSONEncoder):
|
|||
elif isinstance(obj, datetime.timedelta):
|
||||
return str(obj.total_seconds())
|
||||
elif isinstance(obj, decimal.Decimal):
|
||||
# Serializers will coerce decimals to strings by default.
|
||||
return float(obj)
|
||||
return str(obj)
|
||||
elif isinstance(obj, uuid.UUID):
|
||||
return str(obj)
|
||||
elif isinstance(obj, QuerySet):
|
||||
|
|
Loading…
Reference in New Issue
Block a user