From ade62d8cdbcad02caa76e8c8310c504e4b7fdddb Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Wed, 27 Oct 2021 12:26:12 -0300 Subject: [PATCH] Fix #100 e Resolvendo problema da busca --- sigi/apps/casas/admin.py | 7 +++++-- sigi/apps/convenios/models.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 263b881..d5562de 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -334,8 +334,11 @@ class ExcluirConvenioFilter(admin.SimpleListFilter): return tuple([(p.pk, p.sigla) for p in Projeto.objects.all()]) def queryset(self, request, queryset): - queryset = queryset.exclude(convenio__projeto_id=self.value()) - return queryset.distinct('municipio__uf__nome', 'nome') + if (self.value() is None): + return queryset + else: + queryset = queryset.exclude(convenio__projeto_id=self.value()).distinct('municipio__uf__nome', 'nome') + return queryset class ServicoFilter(admin.SimpleListFilter): title = _(u"Serviço") diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 3e9aafb..5ab575e 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -10,6 +10,7 @@ from django.utils.translation import ugettext as _ from sigi.apps.utils import SearchField, to_ascii from sigi.apps.casas.models import Orgao from sigi.apps.servidores.models import Servidor, Servico +#from sigi.apps.convenios.admin import ConvenioAdmin class Projeto(models.Model): """ Modelo para representar os projetos do programa @@ -65,7 +66,6 @@ class Convenio(models.Model): blank=True, help_text=_(u'Formatos:
Antigo: XXXXXX/XX-X.
SIGAD: XXXXX.XXXXXX/XXXX-XX') ) - fieldsets = ({'fields':('num_processo_sf',)}) num_convenio = models.CharField( _(u'número do convênio'), max_length=10,