Permalink
Browse files

Simple support for DecimalField

Converts Decimal values from the queryset into float.
  • Loading branch information...
1 parent d951300 commit e892f5ffb16e0f6c799cd4e062f079b5b6f780cc @kriberg kriberg committed Mar 9, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 djangbone/views.py
View
@@ -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):

0 comments on commit e892f5f

Please sign in to comment.