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