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,