Tweak grid configuration for Employees view

This commit is contained in:
Lance Edgar 2017-03-10 12:45:44 -06:00
parent 7a63f11dae
commit 693c2dce57

View file

@ -45,8 +45,7 @@ class EmployeesView(MasterView):
""" """
model_class = model.Employee model_class = model.Employee
def configure_grid(self, g): def _preconfigure_grid(self, g):
g.joiners['phone'] = lambda q: q.outerjoin(model.EmployeePhoneNumber, sa.and_( g.joiners['phone'] = lambda q: q.outerjoin(model.EmployeePhoneNumber, sa.and_(
model.EmployeePhoneNumber.parent_uuid == model.Employee.uuid, model.EmployeePhoneNumber.parent_uuid == model.Employee.uuid,
model.EmployeePhoneNumber.preference == 1)) model.EmployeePhoneNumber.preference == 1))
@ -89,6 +88,8 @@ class EmployeesView(MasterView):
g.append(forms.AssociationProxyField('first_name')) g.append(forms.AssociationProxyField('first_name'))
g.append(forms.AssociationProxyField('last_name')) g.append(forms.AssociationProxyField('last_name'))
def configure_grid(self, g):
g.configure( g.configure(
include=[ include=[
g.id.label("ID"), g.id.label("ID"),