diff --git a/tailbone/views/handheld.py b/tailbone/views/handheld.py index 88464dec..95fda982 100644 --- a/tailbone/views/handheld.py +++ b/tailbone/views/handheld.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8; -*- ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2016 Lance Edgar +# Copyright © 2010-2017 Lance Edgar # # This file is part of Rattail. # @@ -85,11 +85,12 @@ class HandheldBatchView(FileBatchMasterView): rows_editable = True def configure_grid(self, g): - enum = self.rattail_config.get_enum() + device_types = OrderedDict(sorted(self.enum.HANDHELD_DEVICE_TYPE.items(), + key=lambda item: item[1])) g.configure( include=[ g.id, - g.device_type.with_renderer(forms.renderers.EnumFieldRenderer(enum.HANDHELD_DEVICE_TYPE)), + g.device_type.with_renderer(forms.renderers.EnumFieldRenderer(device_types)), g.device_name, g.created, g.created_by, @@ -105,9 +106,13 @@ class HandheldBatchView(FileBatchMasterView): attrs['class_'] = 'notice' return attrs - def configure_fieldset(self, fs): - fs.device_type.set(renderer=forms.renderers.EnumFieldRenderer(enum.HANDHELD_DEVICE_TYPE)) + def _preconfigure_fieldset(self, fs): + super(HandheldBatchView, self)._preconfigure_fieldset(fs) + device_types = OrderedDict(sorted(self.enum.HANDHELD_DEVICE_TYPE.items(), + key=lambda item: item[1])) + fs.device_type.set(renderer=forms.renderers.EnumFieldRenderer(device_types)) + def configure_fieldset(self, fs): if self.creating: fs.configure( include=[