Add sort/filter for Department Name, in Subdepartments grid

This commit is contained in:
Lance Edgar 2020-03-15 14:26:56 -05:00
parent 9b00e829b8
commit da4f2b2081

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar # Copyright © 2010-2020 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -58,9 +58,17 @@ class SubdepartmentsView(MasterView):
def configure_grid(self, g): def configure_grid(self, g):
super(SubdepartmentsView, self).configure_grid(g) super(SubdepartmentsView, self).configure_grid(g)
# name
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.set_sort_defaults('name') g.set_sort_defaults('name')
# department (name)
g.set_joiner('department', lambda q: q.outerjoin(model.Department))
g.set_sorter('department', model.Department.name)
g.set_filter('department', model.Department.name)
g.set_link('number') g.set_link('number')
g.set_link('name') g.set_link('name')