Browse Source

Teste fix Travis

pull/907/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
4f04eedcd7
  1. 25
      sapl/materia/views.py

25
sapl/materia/views.py

@ -784,16 +784,21 @@ class RelatoriaCrud(MasterDetailCrud):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
comissao = Comissao.objects.get(
pk=context['form'].initial['comissao'])
composicao = comissao.composicao_set.last()
participacao = Participacao.objects.filter(composicao=composicao)
parlamentares = []
for p in participacao:
parlamentares.append(
[p.parlamentar.id, p.parlamentar.nome_parlamentar])
context['form'].fields['parlamentar'].choices = parlamentares
try:
comissao = Comissao.objects.get(
pk=context['form'].initial['comissao'])
except ObjectDoesNotExist:
pass
else:
composicao = comissao.composicao_set.last()
participacao = Participacao.objects.filter(
composicao=composicao)
parlamentares = []
for p in participacao:
parlamentares.append(
[p.parlamentar.id, p.parlamentar.nome_parlamentar])
context['form'].fields['parlamentar'].choices = parlamentares
return context

Loading…
Cancel
Save