Skip to content

Commit

Permalink
[slice_json] pass slice id to get_form_data() (apache#4607)
Browse files Browse the repository at this point in the history
  • Loading branch information
williaster authored and michellethomas committed May 23, 2018
1 parent 4efb789 commit cdc5d60
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ def get_form_data(self, slice_id=None):
# the form_data from the DB with the other form_data provided
slice_id = form_data.get('slice_id') or slice_id
slc = None

if slice_id:
slc = db.session.query(models.Slice).filter_by(id=slice_id).first()
slice_form_data = slc.form_data.copy()
Expand Down Expand Up @@ -1122,10 +1123,10 @@ def generate_json(self, datasource_type, datasource_id, form_data,
@expose('/slice_json/<slice_id>')
def slice_json(self, slice_id):
try:
viz_obj = self.get_viz(slice_id)
datasource_type = viz_obj.datasource.type
datasource_id = viz_obj.datasource.id
form_data, slc = self.get_form_data()
form_data, slc = self.get_form_data(slice_id)
datasource_type = slc.datasource.type
datasource_id = slc.datasource.id

except Exception as e:
return json_error_response(
utils.error_msg_from_exception(e),
Expand Down

0 comments on commit cdc5d60

Please sign in to comment.