Accept value_enum
kwarg when creating grid filter
and do the "normal" thing for that if one is given
This commit is contained in:
parent
873104d573
commit
f17617c659
|
@ -138,12 +138,17 @@ class GridFilter(object):
|
|||
|
||||
value_renderer_factory = DefaultValueRenderer
|
||||
|
||||
def __init__(self, key, label=None, verbs=None, value_renderer=None,
|
||||
def __init__(self, key, label=None, verbs=None, value_enum=None, value_renderer=None,
|
||||
default_active=False, default_verb=None, default_value=None, **kwargs):
|
||||
self.key = key
|
||||
self.label = label or prettify(key)
|
||||
self.verbs = verbs or self.get_default_verbs()
|
||||
self.set_value_renderer(value_renderer or self.value_renderer_factory)
|
||||
if value_renderer:
|
||||
self.set_value_renderer(value_renderer)
|
||||
elif value_enum:
|
||||
self.set_value_renderer(EnumValueRenderer(value_enum))
|
||||
else:
|
||||
self.set_value_renderer(self.value_renderer_factory)
|
||||
self.default_active = default_active
|
||||
self.default_verb = default_verb
|
||||
self.default_value = default_value
|
||||
|
|
Loading…
Reference in a new issue