From be71cb300eff26e0e1bda325839111451582960a Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 10 Dec 2015 09:31:55 -0200 Subject: [PATCH] Fix query error --- painel/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/painel/views.py b/painel/views.py index ee17f9616..924c81ff3 100644 --- a/painel/views.py +++ b/painel/views.py @@ -1,4 +1,3 @@ -import datetime from datetime import date from django.core.exceptions import ObjectDoesNotExist @@ -10,7 +9,7 @@ from parlamentares.models import Filiacao from sapl.crud import build_crud from sessao.models import (OrdemDia, PresencaOrdemDia, RegistroVotacao, SessaoPlenaria, SessaoPlenariaPresenca, - TipoResultadoVotacao, VotoParlamentar) + VotoParlamentar) from .models import Cronometro @@ -149,8 +148,8 @@ def response_null_materia(response): def get_votos(response, materia): - registro = RegistroVotacao.objects.get( - ordem=materia, materia=materia.materia) + registro = RegistroVotacao.objects.filter( + ordem=materia, materia=materia.materia).last() total = (registro.numero_votos_sim + registro.numero_votos_nao + registro.numero_abstencoes)