From cefbd4df7ab18b351aad9d3ce9fc4f143192eeee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 19 Jun 2023 21:52:01 +0200 Subject: [PATCH] =?UTF-8?q?Oprava=20v=C3=BDsledkovky=20do=20posledn=C3=ADh?= =?UTF-8?q?o=20=C4=8D=C3=ADsla=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/views_all.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index e35742c7..8e71fed3 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -535,7 +535,9 @@ class PosledniCisloVysledkovkaView(generic.DetailView): def get_context_data(self, **kwargs): context = super(PosledniCisloVysledkovkaView, self).get_context_data() rocnik = context['rocnik'] - cislo = rocnik.cisla.order_by("poradi").last() + cislo = rocnik.cisla.order_by("poradi").filter(deadline_v_cisle__isnull=False).last() + if cislo is None: + raise Http404(f"Ročník {rocnik.rocnik} nemá číslo s deadlinem.") cislopred = cislo.predchozi() context['vysledkovka'] = VysledkovkaDoTeXu( cislo,