diff --git a/tailbone/grids/filters.py b/tailbone/grids/filters.py index 87523d32..8b66b090 100644 --- a/tailbone/grids/filters.py +++ b/tailbone/grids/filters.py @@ -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