Tweak default factory for boolean grid filters
This commit is contained in:
parent
7afd9c87df
commit
1f9a27a7ae
|
@ -102,7 +102,8 @@ class AlchemyGrid(Grid):
|
|||
elif isinstance(column.type, sa.Integer):
|
||||
factory = filters.AlchemyNumericFilter
|
||||
elif isinstance(column.type, sa.Boolean):
|
||||
factory = filters.AlchemyBooleanFilter
|
||||
# TODO: check column for nullable here?
|
||||
factory = filters.AlchemyNullableBooleanFilter
|
||||
elif isinstance(column.type, sa.Date):
|
||||
factory = filters.AlchemyDateFilter
|
||||
elif isinstance(column.type, sa.DateTime):
|
||||
|
|
|
@ -336,7 +336,7 @@ class AlchemyBooleanFilter(AlchemyGridFilter):
|
|||
"""
|
||||
Boolean filter for SQLAlchemy.
|
||||
"""
|
||||
default_verbs = ['is_true', 'is_false', 'is_null', 'is_not_null', 'is_any']
|
||||
default_verbs = ['is_true', 'is_false', 'is_any']
|
||||
|
||||
def filter_is_true(self, query, value):
|
||||
"""
|
||||
|
@ -353,6 +353,13 @@ class AlchemyBooleanFilter(AlchemyGridFilter):
|
|||
return query.filter(self.column == False)
|
||||
|
||||
|
||||
class AlchemyNullableBooleanFilter(AlchemyBooleanFilter):
|
||||
"""
|
||||
Boolean filter for SQLAlchemy which is NULL-aware.
|
||||
"""
|
||||
default_verbs = ['is_true', 'is_false', 'is_null', 'is_not_null', 'is_any']
|
||||
|
||||
|
||||
class AlchemyDateFilter(AlchemyGridFilter):
|
||||
"""
|
||||
Date filter for SQLAlchemy.
|
||||
|
|
Loading…
Reference in a new issue