From 96ea3b8f2dd4c7380c7e59f4a0546e6c27b09ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Sun, 13 Feb 2022 10:51:26 -0300 Subject: [PATCH] Melhorar performance filtro por gerentes --- sigi/apps/casas/filters.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sigi/apps/casas/filters.py b/sigi/apps/casas/filters.py index f9aacb4..89f5264 100644 --- a/sigi/apps/casas/filters.py +++ b/sigi/apps/casas/filters.py @@ -7,10 +7,10 @@ from sigi.apps.servicos.models import TipoServico class GerentesInterlegisFilter(admin.filters.RelatedFieldListFilter): def __init__(self, *args, **kwargs): - super(GerentesInterlegisFilter, self).__init__(*args, **kwargs) - gerentes = Servidor.objects.filter( - casas_que_gerencia__isnull=False).order_by( - 'nome_completo').distinct() + super().__init__(*args, **kwargs) + gerentes = Servidor.objects.exclude( + casas_que_gerencia=None).order_by( + 'nome_completo') self.lookup_choices = [(x.id, x) for x in gerentes] class ConvenioFilter(admin.SimpleListFilter):