Tweak how a grid filter factory is determined
Don't inspect anything if a factory is provided by caller.
This commit is contained in:
parent
65d1c24230
commit
1c45472fe5
|
@ -93,22 +93,23 @@ class AlchemyGrid(Grid):
|
||||||
"""
|
"""
|
||||||
Make a filter suitable for use with the given column.
|
Make a filter suitable for use with the given column.
|
||||||
"""
|
"""
|
||||||
factory = filters.AlchemyGridFilter
|
factory = kwargs.pop('factory', None)
|
||||||
if isinstance(column.type, sa.String):
|
if not factory:
|
||||||
factory = filters.AlchemyStringFilter
|
factory = filters.AlchemyGridFilter
|
||||||
elif isinstance(column.type, sa.Numeric):
|
if isinstance(column.type, sa.String):
|
||||||
factory = filters.AlchemyNumericFilter
|
factory = filters.AlchemyStringFilter
|
||||||
elif isinstance(column.type, sa.Integer):
|
elif isinstance(column.type, sa.Numeric):
|
||||||
factory = filters.AlchemyNumericFilter
|
factory = filters.AlchemyNumericFilter
|
||||||
elif isinstance(column.type, sa.Boolean):
|
elif isinstance(column.type, sa.Integer):
|
||||||
factory = filters.AlchemyBooleanFilter
|
factory = filters.AlchemyNumericFilter
|
||||||
elif isinstance(column.type, sa.Date):
|
elif isinstance(column.type, sa.Boolean):
|
||||||
factory = filters.AlchemyDateFilter
|
factory = filters.AlchemyBooleanFilter
|
||||||
elif isinstance(column.type, sa.DateTime):
|
elif isinstance(column.type, sa.Date):
|
||||||
factory = filters.AlchemyDateTimeFilter
|
factory = filters.AlchemyDateFilter
|
||||||
elif isinstance(column.type, GPCType):
|
elif isinstance(column.type, sa.DateTime):
|
||||||
factory = filters.AlchemyGPCFilter
|
factory = filters.AlchemyDateTimeFilter
|
||||||
factory = kwargs.pop('factory', factory)
|
elif isinstance(column.type, GPCType):
|
||||||
|
factory = filters.AlchemyGPCFilter
|
||||||
return factory(key, column=column, config=self.request.rattail_config, **kwargs)
|
return factory(key, column=column, config=self.request.rattail_config, **kwargs)
|
||||||
|
|
||||||
def iter_filters(self):
|
def iter_filters(self):
|
||||||
|
|
Loading…
Reference in a new issue