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): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
comissao = Comissao.objects.get( try:
pk=context['form'].initial['comissao']) comissao = Comissao.objects.get(
composicao = comissao.composicao_set.last() pk=context['form'].initial['comissao'])
participacao = Participacao.objects.filter(composicao=composicao) except ObjectDoesNotExist:
pass
parlamentares = [] else:
for p in participacao: composicao = comissao.composicao_set.last()
parlamentares.append( participacao = Participacao.objects.filter(
[p.parlamentar.id, p.parlamentar.nome_parlamentar]) composicao=composicao)
context['form'].fields['parlamentar'].choices = parlamentares
parlamentares = []
for p in participacao:
parlamentares.append(
[p.parlamentar.id, p.parlamentar.nome_parlamentar])
context['form'].fields['parlamentar'].choices = parlamentares
return context return context

Loading…
Cancel
Save