Skip to content

Commit

Permalink
Debuggin'
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed May 23, 2016
1 parent 879a154 commit 3fc78b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions caravel/forms.py
Expand Up @@ -651,7 +651,9 @@ def add_to_form(attrs):

filter_choices = self.choicify(['in', 'not in'])
# datasource type specific form elements
if viz.datasource.__class__.__name__ == 'SqlaTable':
datasource_classname = viz.datasource.__class__.__name__
time_fields = None
if datasource_classname == 'SqlaTable':
QueryForm.fieldsets += ({
'label': 'SQL',
'fields': ['where', 'having'],
Expand Down Expand Up @@ -680,7 +682,7 @@ def add_to_form(attrs):
else:
time_fields = 'granularity_sqla'
add_to_form((time_fields, ))
else:
elif datasource_classname == 'DruidDatasource':
time_fields = ('granularity', 'druid_time_origin')
add_to_form(('granularity', 'druid_time_origin'))
field_css_classes['granularity'] = ['form-control', 'select2_freeform']
Expand All @@ -702,7 +704,7 @@ def add_to_form(attrs):
QueryForm, 'flt_eq_' + str(i),
TextField("Super", default=''))

if viz.datasource.any_dttm_col:
if time_fields:
QueryForm.fieldsets = ({
'label': 'Time',
'fields': (
Expand Down
1 change: 1 addition & 0 deletions tests/core_tests.py
Expand Up @@ -319,6 +319,7 @@ def test_client(self, PyDruid):
df = pd.DataFrame(nres)
instance.export_pandas.return_value = df
instance.query_dict = {}
instance.query_builder.last_query.query_dict = {}
resp = self.client.get('/caravel/explore/druid/1/?viz_type=table&granularity=one+day&druid_time_origin=&since=7+days+ago&until=now&row_limit=5000&include_search=false&metrics=count&groupby=name&flt_col_0=dim1&flt_op_0=in&flt_eq_0=&slice_id=&slice_name=&collapsed_fieldsets=&action=&datasource_name=test_datasource&datasource_id=1&datasource_type=druid&previous_viz_type=table&json=true&force=true')
print('-'*300)
print(resp.data.decode('utf-8'))
Expand Down

0 comments on commit 3fc78b1

Please sign in to comment.