def post(self): query_def = request.get_json(force=True) for field in ['id', 'created_at', 'api_key', 'visualizations', 'latest_query_data', 'last_modified_by']: query_def.pop(field, None) query_def['user'] = self.current_user query_def['data_source'] = query_def.pop('data_source_id') query = models.Query(**query_def) query.save() return query.to_dict()
def post(self): query_def = request.get_json(force=True) # id, created_at, api_key for field in [ 'id', 'created_at', 'api_key', 'visualizations', 'latest_query_data' ]: query_def.pop(field, None) query_def['user'] = self.current_user query = models.Query(**query_def) query.save() query.create_default_visualizations() return query.to_dict(with_result=False)