Fix value auto-selection for enum grid filters

This commit is contained in:
Lance Edgar 2017-10-22 20:56:30 -07:00
parent 401cba23b7
commit 52342a7612

View file

@ -29,6 +29,7 @@ from __future__ import unicode_literals, absolute_import
import datetime import datetime
import logging import logging
import six
import sqlalchemy as sa import sqlalchemy as sa
from rattail.gpc import GPC from rattail.gpc import GPC
@ -106,7 +107,7 @@ class EnumValueRenderer(ChoiceValueRenderer):
def __init__(self, enum): def __init__(self, enum):
sorted_keys = sorted(enum, key=lambda k: enum[k].lower()) sorted_keys = sorted(enum, key=lambda k: enum[k].lower())
self.options = [tags.Option(enum[k], k) for k in sorted_keys] self.options = [tags.Option(enum[k], six.text_type(k)) for k in sorted_keys]
class GridFilter(object): class GridFilter(object):