Convert value for date filter; only add condition if valid

This commit is contained in:
Lance Edgar 2022-08-27 22:45:52 -05:00
parent 36ba6f1463
commit 187fea6d1b

View file

@ -682,6 +682,23 @@ class AlchemyDateFilter(AlchemyGridFilter):
else: else:
return dt.date() return dt.date()
def filter_equal(self, query, value):
date = self.make_date(value)
if not date:
return query
return query.filter(self.column == self.encode_value(date))
def filter_not_equal(self, query, value):
date = self.make_date(value)
if not date:
return query
return query.filter(sa.or_(
self.column == None,
self.column != self.encode_value(date),
))
def filter_between(self, query, value): def filter_between(self, query, value):
""" """
Filter data with a "between" query. Really this uses ">=" and "<=" Filter data with a "between" query. Really this uses ">=" and "<="