From 4db13e2e753ccc7d323305b90b3715f56a71d7be Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 23 Nov 2015 11:11:27 -0200 Subject: [PATCH] Fix get problem in Relatoria --- materia/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/materia/views.py b/materia/views.py index ab09400b6..5da76396f 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1231,7 +1231,8 @@ class RelatoriaEditView(FormMixin, GenericView): materia = MateriaLegislativa.objects.get(id=kwargs['pk']) relatoria = Relatoria.objects.get( id=kwargs['id']) - composicao = Composicao.objects.get(comissao=relatoria.comissao) + composicao = Composicao.objects.filter( + comissao=relatoria.comissao).last() parlamentares = composicao.participacao_set.all() return self.render_to_response( @@ -1245,7 +1246,7 @@ class RelatoriaEditView(FormMixin, GenericView): form = RelatoriaForm(request.POST) materia = MateriaLegislativa.objects.get(id=kwargs['pk']) relatoria = Relatoria.objects.get(id=kwargs['id']) - composicao = Composicao.objects.get(comissao=relatoria.comissao) + composicao = Composicao.objects.filter(comissao=relatoria.comissao).last() parlamentares = composicao.participacao_set.all() if form.is_valid(): @@ -1328,7 +1329,7 @@ class RelatoriaView(FormMixin, GenericView): 'relatorias': relatorias, 'error_localizacao': 'O local atual deve ser uma Comissão!'}) else: - composicao = Composicao.objects.get(comissao=comissao) + composicao = Composicao.objects.filter(comissao=comissao).last() parlamentares = composicao.participacao_set.all() return self.render_to_response( {'materialegislativa': materia,