Honor enum sort order where possible, for grid filter values
This commit is contained in:
parent
43122381f5
commit
f755aefbfa
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2018 Lance Edgar
|
||||
# Copyright © 2010-2019 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -108,7 +108,10 @@ class EnumValueRenderer(ChoiceValueRenderer):
|
|||
"""
|
||||
|
||||
def __init__(self, enum):
|
||||
sorted_keys = sorted(enum, key=lambda k: enum[k].lower())
|
||||
if isinstance(enum, OrderedDict):
|
||||
sorted_keys = list(enum.keys())
|
||||
else:
|
||||
sorted_keys = sorted(enum, key=lambda k: enum[k].lower())
|
||||
self.options = [tags.Option(enum[k], six.text_type(k)) for k in sorted_keys]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue