diff --git a/tailbone/newgrids/filters.py b/tailbone/newgrids/filters.py index fae3d445..e1bde681 100644 --- a/tailbone/newgrids/filters.py +++ b/tailbone/newgrids/filters.py @@ -91,13 +91,11 @@ class ChoiceValueRenderer(FilterValueRenderer): Renders value input as a dropdown/selectmenu of available choices. """ - def __init__(self, choices): - self.choices = choices + def __init__(self, options): + self.options = options def render(self, value=None, **kwargs): - options = tags.Options([tags.Option(label, value=value) - for value, label in self.choices]) - return tags.select(self.name, [value], options, **kwargs) + return tags.select(self.name, [value], self.options, **kwargs) class EnumValueRenderer(ChoiceValueRenderer): @@ -107,7 +105,7 @@ class EnumValueRenderer(ChoiceValueRenderer): def __init__(self, enum): sorted_keys = sorted(enum, key=lambda k: enum[k].lower()) - self.choices = [(k, enum[k]) for k in sorted_keys] + self.options = [tags.Option(enum[k], k) for k in sorted_keys] class GridFilter(object):