From e912bc1adf22a7ac7ce648acd3c31402d6ca7510 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Mon, 7 Mar 2016 18:13:45 -0300 Subject: [PATCH] =?UTF-8?q?Resolve=20quebra=20na=20tela=20de=20composi?= =?UTF-8?q?=C3=A7ao=20de=20uma=20comissao.=20Esta=20quebra=20ocorria=20ao?= =?UTF-8?q?=20clicar=20em=20um=20parlamentar=20com=20mais=20de=20um=20part?= =?UTF-8?q?ido=20cadastrado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comissoes/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comissoes/views.py b/comissoes/views.py index 46e57aa85..4ce30707c 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -136,9 +136,11 @@ class ComissaoParlamentarEditView(FormMixin, GenericView): participacao_id = kwargs['id'] participacao = Participacao.objects.get(id=participacao_id) comissao = Comissao.objects.get(id=self.kwargs['pk']) + id_parlamentar = Filiacao.objects.filter( + parlamentar__id=participacao.parlamentar.id) + id_parlamentar = id_parlamentar.last().id form = ParticipacaoCadastroForm( - initial={'parlamentar_id': (Filiacao.objects.get( - parlamentar__id=participacao.parlamentar.id).id)}, + initial={'parlamentar_id': id_parlamentar}, instance=participacao) return self.render_to_response({'form': form, 'comissao': comissao,