Browse Source

Corrigindo apresentação de parlamentar na pesquisa

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

9
sapl/api/serializers.py

@ -62,11 +62,14 @@ class ParlamentarResumeSerializer(serializers.ModelSerializer):
partido = serializers.SerializerMethodField('check_partido') partido = serializers.SerializerMethodField('check_partido')
def check_titular(self,obj): def check_titular(self,obj):
is_titular = None
if Legislatura.objects.exists():
legislatura = self.context.get('legislatura') legislatura = self.context.get('legislatura')
if not legislatura: if not legislatura:
legislatura = Legislatura.objects.first().id legislatura = Legislatura.objects.first()
mandato = Mandato.objects.filter(legislatura__id=legislatura,parlamentar=obj).first() mandato = Mandato.objects.filter(legislatura=legislatura,parlamentar=obj).first()
return mandato.titular if mandato else False is_titular = mandato.titular if mandato else False
return is_titular
def check_partido(self,obj): def check_partido(self,obj):
legislatura_id = self.context.get('legislatura') 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"> <table class="table table-striped table-hover table-link-ordering">
<thead> <thead>
<tr> <tr>
{% for name in headers %} <th colspan=2 >Parlamentar</th>
{% if forloop.first %} <th>Parido</th>
<th colspan=2> <th>Ativo?</th>
{% else %} <th v-if="!is_pesquisa" >Titlar?</th>
<th>
{% endif %}
{{ name }}
</th>
{% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -75,7 +70,7 @@
<p v-if="[[ parlamentar.ativo ]]">Sim</p> <p v-if="[[ parlamentar.ativo ]]">Sim</p>
<p v-else>Não</p> <p v-else>Não</p>
</th> </th>
<th> <th v-if="!is_pesquisa">
<p v-if='[[ parlamentar.titular]]'>Sim</p> <p v-if='[[ parlamentar.titular]]'>Sim</p>
<p v-else>Não</p> <p v-else>Não</p>
</th> </th>

Loading…
Cancel
Save