Browse Source

Melhorar performance filtro por gerentes

revisaoSidenav
Sesostris Vieira 3 years ago
parent
commit
96ea3b8f2d
  1. 8
      sigi/apps/casas/filters.py

8
sigi/apps/casas/filters.py

@ -7,10 +7,10 @@ from sigi.apps.servicos.models import TipoServico
class GerentesInterlegisFilter(admin.filters.RelatedFieldListFilter): class GerentesInterlegisFilter(admin.filters.RelatedFieldListFilter):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(GerentesInterlegisFilter, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
gerentes = Servidor.objects.filter( gerentes = Servidor.objects.exclude(
casas_que_gerencia__isnull=False).order_by( casas_que_gerencia=None).order_by(
'nome_completo').distinct() 'nome_completo')
self.lookup_choices = [(x.id, x) for x in gerentes] self.lookup_choices = [(x.id, x) for x in gerentes]
class ConvenioFilter(admin.SimpleListFilter): class ConvenioFilter(admin.SimpleListFilter):

Loading…
Cancel
Save