Add sort/filter for department name, for Categories grid

This commit is contained in:
Lance Edgar 2018-05-02 10:37:17 -05:00
parent 7f567dec3a
commit c869238678

View file

@ -58,6 +58,11 @@ class CategoriesView(MasterView):
super(CategoriesView, self).configure_grid(g) super(CategoriesView, self).configure_grid(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.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_sort_defaults('code') g.set_sort_defaults('code')
g.set_link('code') g.set_link('code')
g.set_link('number') g.set_link('number')