From 92cb8ec206d6a353d113a4856b2718240de08b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 22 May 2023 21:53:14 +0200 Subject: [PATCH] =?UTF-8?q?Odevzd=C3=A1v=C3=A1tko:=20Osamocen=C3=BD=20nadp?= =?UTF-8?q?robl=C3=A9m=20se=20vybere=20automaticky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index 04606b4c..f980b1d8 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -416,7 +416,12 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): return super().get(request, *args, **kwargs) def get_initial(self): - return {"nadproblem_id": self.kwargs["nadproblem_id"]} + nadproblem_id = self.kwargs["nadproblem_id"] + return { + "nadproblem_id": nadproblem_id, + "problem": [] if m.Problem.objects.filter(stav=m.Problem.STAV_ZADANY, nadproblem__id=nadproblem_id) else nadproblem_id + + } def get_context_data(self,**kwargs): data = super().get_context_data(**kwargs)