bijoe: flatten Decimal to unicode in JSON export
This commit is contained in:
parent
0db609c84c
commit
32d5d1316a
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import datetime
|
||||
import decimal
|
||||
|
||||
from django.views.generic import TemplateView, FormView
|
||||
from django.http import Http404
|
||||
|
@ -127,6 +128,8 @@ class CubeView(CubeMixin, FormView):
|
|||
for measure, cell in zip(ctx['measures'], row[len(ctx['drilldown']):]):
|
||||
if isinstance(cell, datetime.timedelta):
|
||||
cell = cell.days + cell.seconds / 86400.
|
||||
if isinstance(cell, decimal.Decimal):
|
||||
cell = float(cell)
|
||||
measures.append({'label': measure.label, 'value': cell})
|
||||
json_data.append({'coords': coords, 'measures': measures})
|
||||
|
||||
|
|
Loading…
Reference in New Issue