Tweak device type list field when making new handheld batch
i.e. sort by display name, etc.
This commit is contained in:
parent
b2f96f4217
commit
1ce2f410d0
|
@ -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=[
|
||||
|
|
Loading…
Reference in a new issue