use .to_json() method to expose measures and dimensions to templates (fixes #12735)

This commit is contained in:
Benjamin Dauvergne 2016-07-25 10:06:08 +02:00
parent c51df1f593
commit fb23c28f1f
1 changed files with 2 additions and 4 deletions

View File

@ -211,12 +211,10 @@ class CubeView(AuthorizationMixin, CubeMixin, FormView):
ctx['grouped_data'] = list(self.get_grouped_data(form.cleaned_data))
ctx['measures'] = [self.cube.measures[measure] for measure in
form.cleaned_data['measures']]
ctx['measures_json'] = json.dumps([
{'name': measure.name, 'label': measure.label} for measure in ctx['measures']])
ctx['measures_json'] = json.dumps([measure.to_json() for measure in ctx['measures']])
ctx['drilldown'] = [self.cube.dimensions[dimension] for dimension in
form.cleaned_data['drilldown']]
ctx['drilldown_json'] = json.dumps([
{'name': dim.name, 'label': dim.label} for dim in ctx['drilldown']])
ctx['drilldown_json'] = json.dumps([dim.to_json() for dim in ctx['drilldown']])
json_data = []
for row in self.get_data(form.cleaned_data, stringify=False):
coords = []