Ejemplo n.º 1
0
 def save(self):
     if hasattr(self, 'chart_id'):
         chart = get_object_or_404(Chart, pk=self.chart_id)
     else:
         chart = Chart()
         report = get_object_or_404(Report, pk=self.report_id)
         chart.report = report
     chart.name = self.data['title']
     chart.options = dumps(self.data)
     chart.save()
     return chart