Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simple support for DecimalField

Converts Decimal values from the queryset into float.
  • Loading branch information...
commit e892f5ffb16e0f6c799cd4e062f079b5b6f780cc 1 parent d951300
@kriberg kriberg authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  djangbone/views.py
View
2  djangbone/views.py
@@ -1,4 +1,5 @@
import datetime
+import decimal
import json
from django.core.exceptions import ObjectDoesNotExist
@@ -17,6 +18,7 @@ def default(self, obj):
Convert datetime objects to ISO-compatible strings during json serialization.
"""
return obj.isoformat() if isinstance(obj, datetime.datetime) else None
+ return float(obj) if isinstance(obj, decimal.Decimal) else None
class BackboneAPIView(View):
Please sign in to comment.
Something went wrong with that request. Please try again.