Add code field to Category views

This commit is contained in:
Lance Edgar 2016-10-03 15:37:31 -05:00
parent 29ec662ead
commit f41135a2e0
2 changed files with 5 additions and 2 deletions

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2015 Lance Edgar # Copyright © 2010-2016 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -43,9 +43,10 @@ class CategoriesView(MasterView):
def configure_grid(self, g): def configure_grid(self, g):
g.filters['name'].default_active = True g.filters['name'].default_active = True
g.filters['name'].default_verb = 'contains' g.filters['name'].default_verb = 'contains'
g.default_sortkey = 'number' g.default_sortkey = 'code'
g.configure( g.configure(
include=[ include=[
g.code,
g.number, g.number,
g.name, g.name,
g.department, g.department,
@ -55,6 +56,7 @@ class CategoriesView(MasterView):
def configure_fieldset(self, fs): def configure_fieldset(self, fs):
fs.configure( fs.configure(
include=[ include=[
fs.code,
fs.number, fs.number,
fs.name, fs.name,
fs.department, fs.department,

View file

@ -620,6 +620,7 @@ class MasterView(View):
Returns the unique key to be used for the grid, for caching sort/filter Returns the unique key to be used for the grid, for caching sort/filter
options etc. options etc.
""" """
# TODO: default here should probably come from route_prefix instead?
return getattr(cls, 'grid_key', '{0}s'.format(cls.get_normalized_model_name())) return getattr(cls, 'grid_key', '{0}s'.format(cls.get_normalized_model_name()))
def make_grid_kwargs(self, **kwargs): def make_grid_kwargs(self, **kwargs):