From ff576f8cfdecc6d24860d0b2dda6919a65eb3a28 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Thu, 20 Oct 2016 17:39:37 -0200 Subject: [PATCH] =?UTF-8?q?Trata=20o=20caso=20em=20que=20a=20sess=C3=A3o?= =?UTF-8?q?=20do=20relat=C3=B3rio=20n=C3=A3o=20existe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/relatorios/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 82fd7edf7..2900ee9a8 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -1,6 +1,8 @@ from datetime import datetime from bs4 import BeautifulSoup + +from django.core.exceptions import ObjectDoesNotExist from django.http import Http404, HttpResponse from django.utils.translation import ugettext_lazy as _ @@ -783,7 +785,10 @@ def relatorio_sessao_plenaria(request, pk): rodape = get_rodape(casa) imagem = get_imagem(casa) - sessao = SessaoPlenaria.objects.get(id=pk) + try: + sessao = SessaoPlenaria.objects.get(id=pk) + except ObjectDoesNotExist: + raise Http404('Essa página não existe') (inf_basicas_dic, lst_mesa,