From da4f2b2081574847db8b97c9b690d692b83655c4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 15 Mar 2020 14:26:56 -0500 Subject: [PATCH] Add sort/filter for Department Name, in Subdepartments grid --- tailbone/views/subdepartments.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tailbone/views/subdepartments.py b/tailbone/views/subdepartments.py index 4550999f..584cd7f7 100644 --- a/tailbone/views/subdepartments.py +++ b/tailbone/views/subdepartments.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2020 Lance Edgar # # This file is part of Rattail. # @@ -58,9 +58,17 @@ class SubdepartmentsView(MasterView): def configure_grid(self, g): super(SubdepartmentsView, self).configure_grid(g) + + # name g.filters['name'].default_active = True g.filters['name'].default_verb = 'contains' 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('name')