Convert value for date filter; only add condition if valid
This commit is contained in:
parent
36ba6f1463
commit
187fea6d1b
|
@ -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 "<="
|
||||||
|
|
Loading…
Reference in a new issue