From 9c1fd78118ddb1284f7ff824dc113bea4d9e6624 Mon Sep 17 00:00:00 2001 From: ulyssesBML Date: Wed, 11 Dec 2019 13:04:17 -0300 Subject: [PATCH] =?UTF-8?q?Corrigindo=20apresenta=C3=A7=C3=A3o=20de=20parl?= =?UTF-8?q?amentar=20na=20pesquisa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/api/serializers.py | 13 ++++++++----- .../parlamentares/parlamentares_list.html | 15 +++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/sapl/api/serializers.py b/sapl/api/serializers.py index a37b6d6ab..143948f16 100644 --- a/sapl/api/serializers.py +++ b/sapl/api/serializers.py @@ -62,11 +62,14 @@ class ParlamentarResumeSerializer(serializers.ModelSerializer): partido = serializers.SerializerMethodField('check_partido') def check_titular(self,obj): - legislatura = self.context.get('legislatura') - if not legislatura: - legislatura = Legislatura.objects.first().id - mandato = Mandato.objects.filter(legislatura__id=legislatura,parlamentar=obj).first() - return mandato.titular if mandato else False + is_titular = None + if Legislatura.objects.exists(): + legislatura = self.context.get('legislatura') + if not legislatura: + legislatura = Legislatura.objects.first() + mandato = Mandato.objects.filter(legislatura=legislatura,parlamentar=obj).first() + is_titular = mandato.titular if mandato else False + return is_titular def check_partido(self,obj): legislatura_id = self.context.get('legislatura') diff --git a/sapl/templates/parlamentares/parlamentares_list.html b/sapl/templates/parlamentares/parlamentares_list.html index 29322c55a..7a8aeb304 100644 --- a/sapl/templates/parlamentares/parlamentares_list.html +++ b/sapl/templates/parlamentares/parlamentares_list.html @@ -49,15 +49,10 @@ - {% for name in headers %} - {% if forloop.first %} - - {% endfor %} + + + + @@ -75,7 +70,7 @@

Sim

Não

-