From 1a1eccb7ed5474e3d572a5d72b340c287635f482 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Tue, 27 Oct 2020 22:37:03 +0100 Subject: [PATCH] =?UTF-8?q?Implementace=20zbyl=C3=BDch=20views=20ohledn?= =?UTF-8?q?=C4=9B=20odevzd=C3=A1v=C3=A1tka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/odevzdavatko.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/seminar/views/odevzdavatko.py b/seminar/views/odevzdavatko.py index 137f1fc0..0a121e78 100644 --- a/seminar/views/odevzdavatko.py +++ b/seminar/views/odevzdavatko.py @@ -73,10 +73,27 @@ class ReseniProblemuView(ListView): def get_queryset(self): qs = super().get_queryset() + resitel_id = self.kwargs['resitel'] + if resitel_id is None: + raise ValueError("Nemám řešitele!") + problem_id = self.kwargs['problem'] + if problem_id is None: + raise ValueError("Nemám problém! (To je problém!)") + + resitel = m.Resitel.objects.get(id=resitel_id) + problem = m.Resitel.objects.get(id=problem_id) + qs = qs.filter( + problem__in=[problem], + resitele__in=[resitel], + ) + return qs + + # Kontext automaticky? - - - +class DetailReseniView(DetailView): + model = m.Reseni + template_name = 'TODO' + # To je všechno? Najde se to bude slugem... # Přehled všech řešení kvůli debugování