From aa05edcdc9f851feeae441e01642d19ff7a637e6 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Tue, 1 Nov 2016 09:24:06 -0200 Subject: [PATCH] =?UTF-8?q?Torna=20enumera=C3=A7=C3=A3o=20pythonica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/sessao/views.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 3fc239e02..1a7110e11 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -59,11 +59,9 @@ TipoResultadoVotacaoCrud = CrudAux.build( def reordernar_materias_expediente(request, pk): expedientes = ExpedienteMateria.objects.filter( sessao_plenaria_id=pk) - exp_num = 1 - for e in expedientes: + for exp_num, e in enumerate(expedientes, 1): e.numero_ordem = exp_num e.save() - exp_num += 1 return HttpResponseRedirect( reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk})) @@ -72,11 +70,9 @@ def reordernar_materias_expediente(request, pk): def reordernar_materias_ordem(request, pk): ordens = OrdemDia.objects.filter( sessao_plenaria_id=pk) - ordem_num = 1 - for o in ordens: + for ordem_num, o in enumerate(ordens,1): o.numero_ordem = ordem_num o.save() - ordem_num += 1 return HttpResponseRedirect( reverse('sapl.sessao:ordemdia_list', kwargs={'pk': pk}))