Browse Source

Corrige updateView de RelatoriaCrud para mostrar apenas os membros atuais da comissão (#1213)

Signed-off-by: Eliseu Egewarth <eliseuegewarth@gmail.com>
pull/1226/head
Eliseu Egewarth 8 years ago
committed by Edward
parent
commit
ad0b710363
  1. 22
      sapl/materia/views.py

22
sapl/materia/views.py

@ -883,6 +883,28 @@ class RelatoriaCrud(MasterDetailCrud):
class UpdateView(MasterDetailCrud.UpdateView):
form_class = RelatoriaForm
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
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:
if p.titular:
parlamentares.append(
[p.parlamentar.id, p.parlamentar.nome_parlamentar])
context['form'].fields['parlamentar'].choices = parlamentares
return context
class TramitacaoCrud(MasterDetailCrud):
model = Tramitacao

Loading…
Cancel
Save