From e26df0172963cccb306084d667ff8301d33a735b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 22 May 2023 22:28:14 +0200 Subject: [PATCH] =?UTF-8?q?Odevzd=C3=A1v=C3=A1tko:=20Za=C5=99=C3=ADznut?= =?UTF-8?q?=C3=AD=20p=C5=99=C3=ADstupu=20k=20nezadan=C3=BDm=20probl=C3=A9m?= =?UTF-8?q?=C5=AFm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index f980b1d8..03f3404c 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -403,6 +403,13 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): form_class = f.NahrajReseniForm def get(self, request, *args, **kwargs): + # Zaříznutí nezadaných problémů + nadproblem_id = self.kwargs["nadproblem_id"] + nadproblem = get_object_or_404(m.Problem, id=nadproblem_id) + if nadproblem.stav != "zadany": + raise PermissionDenied() + + # Zaříznutí starých řešitelů: # FIXME: Je to tady dost naprasené, mělo by to asi být jinde… osoba = m.Osoba.objects.get(user=self.request.user)