From 494775980a6fa668370b14c6a2db9fdfd59a0039 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Tue, 25 Jul 2017 15:55:46 -0300 Subject: [PATCH] =?UTF-8?q?Conserta=20anula=C3=A7=C3=A3o=20de=20vota=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/sessao/views.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 16ca533e3..009d4d350 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -1400,9 +1400,8 @@ class VotacaoEditView(SessaoPermissionMixin): ordem_id = kwargs['oid'] if(int(request.POST['anular_votacao']) == 1): - RegistroVotacao.objects.filter( - materia_id=materia_id, - ordem_id=ordem_id).last().delete() + for r in RegistroVotacao.objects.filter(ordem_id=ordem_id): + r.delete() ordem = OrdemDia.objects.get( sessao_plenaria_id=self.object.id, @@ -2165,14 +2164,8 @@ class VotacaoExpedienteEditView(SessaoPermissionMixin): expediente_id = kwargs['oid'] if(int(request.POST['anular_votacao']) == 1): - try: - RegistroVotacao.objects.get( - materia_id=materia_id, - expediente_id=expediente_id).delete() - except MultipleObjectsReturned: - RegistroVotacao.objects.filter( - materia_id=materia_id, - expediente_id=expediente_id).last().delete() + for r in RegistroVotacao.objects.filter(expediente_id=expediente_id): + r.delete() expediente = ExpedienteMateria.objects.get( sessao_plenaria_id=self.object.id,