Add "is false or null" verb for boolean grid filters
This commit is contained in:
parent
c812519931
commit
700813fa57
|
@ -138,6 +138,7 @@ class GridFilter(object):
|
|||
'is_not_null': "is not null",
|
||||
'is_true': "is true",
|
||||
'is_false': "is false",
|
||||
'is_false_null': "is false or null",
|
||||
'contains': "contains",
|
||||
'does_not_contain': "does not contain",
|
||||
'is_me': "is me",
|
||||
|
@ -145,7 +146,7 @@ class GridFilter(object):
|
|||
}
|
||||
|
||||
valueless_verbs = ['is_any', 'is_null', 'is_not_null', 'is_true', 'is_false',
|
||||
'is_me', 'is_not_me']
|
||||
'is_false_null', 'is_me', 'is_not_me']
|
||||
|
||||
value_renderer_factory = DefaultValueRenderer
|
||||
data_type = 'string' # default, but will be set from value renderer
|
||||
|
@ -548,7 +549,16 @@ class AlchemyNullableBooleanFilter(AlchemyBooleanFilter):
|
|||
"""
|
||||
Boolean filter for SQLAlchemy which is NULL-aware.
|
||||
"""
|
||||
default_verbs = ['is_true', 'is_false', 'is_null', 'is_not_null', 'is_any']
|
||||
default_verbs = ['is_true', 'is_false', 'is_false_null',
|
||||
'is_null', 'is_not_null', 'is_any']
|
||||
|
||||
def filter_is_false_null(self, query, value):
|
||||
"""
|
||||
Filter data with an "is false or null" query. Note that this filter
|
||||
does not use the value for anything.
|
||||
"""
|
||||
return query.filter(sa.or_(self.column == False,
|
||||
self.column == None))
|
||||
|
||||
|
||||
class AlchemyDateFilter(AlchemyGridFilter):
|
||||
|
|
Loading…
Reference in a new issue