From 0cc162a806e0595cdd1066328ed88883b47bea94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Thu, 25 Feb 2016 00:34:53 +0100 Subject: [PATCH] =?UTF-8?q?Korektury:=20p=C5=99i=20p=C5=99=C3=ADstupu=20k?= =?UTF-8?q?=20neex.=20pdf=20vra=C5=A5=20404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korektury/views.py b/korektury/views.py index 99f71e00..d6d126e4 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from django.shortcuts import render +from django.shortcuts import get_object_or_404, render from django.views import generic from django.utils.translation import ugettext as _ from django.conf import settings @@ -114,7 +114,7 @@ class KorekturyView(generic.TemplateView): def get_context_data(self, **kwargs): context = super(KorekturyView,self).get_context_data(**kwargs) - pdf = KorekturovanePDF.objects.get(id=self.kwargs['pdf']) + pdf = get_object_or_404(KorekturovanePDF, id=self.kwargs['pdf']) context['pdf'] = pdf context['img_name'] = os.path.split(pdf.pdf.path)[1].split('.')[0] context['img_path'] = settings.KOREKTURY_IMG_DIR