Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise exception when date range is wrong #2141

Merged
merged 1 commit into from
Feb 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ def query_obj(self):
until = extra_filters.get('__to') or form_data.get("until", "now")
to_dttm = utils.parse_human_datetime(until)
if from_dttm > to_dttm:
flasher("The date range doesn't seem right.", "danger")
from_dttm = to_dttm # Making them identical to not raise
raise Exception("From date cannot be larger than to date")

# extras are used to query elements specific to a datasource type
# for instance the extra where clause that applies only to Tables
Expand Down Expand Up @@ -329,8 +328,7 @@ def get_values_for_column(self, column):
until = form_data.get("until", "now")
to_dttm = utils.parse_human_datetime(until)
if from_dttm > to_dttm:
flasher("The date range doesn't seem right.", "danger")
from_dttm = to_dttm # Making them identical to not raise
raise Exception("From date cannot be larger than to date")

kwargs = dict(
column_name=column,
Expand Down