Browse Source

Corrigindo apresentação de parlamentar na pesquisa

pull/3048/head
ulyssesBML 6 years ago
parent
commit
9c1fd78118
  1. 13
      sapl/api/serializers.py
  2. 15
      sapl/templates/parlamentares/parlamentares_list.html

13
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')

15
sapl/templates/parlamentares/parlamentares_list.html

@ -49,15 +49,10 @@
<table class="table table-striped table-hover table-link-ordering">
<thead>
<tr>
{% for name in headers %}
{% if forloop.first %}
<th colspan=2>
{% else %}
<th>
{% endif %}
{{ name }}
</th>
{% endfor %}
<th colspan=2 >Parlamentar</th>
<th>Parido</th>
<th>Ativo?</th>
<th v-if="!is_pesquisa" >Titlar?</th>
</tr>
</thead>
<tbody>
@ -75,7 +70,7 @@
<p v-if="[[ parlamentar.ativo ]]">Sim</p>
<p v-else>Não</p>
</th>
<th>
<th v-if="!is_pesquisa">
<p v-if='[[ parlamentar.titular]]'>Sim</p>
<p v-else>Não</p>
</th>

Loading…
Cancel
Save