|
@ -411,11 +411,15 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): |
|
|
model = m.Reseni |
|
|
model = m.Reseni |
|
|
template_name = 'odevzdavatko/nahraj_reseni.html' |
|
|
template_name = 'odevzdavatko/nahraj_reseni.html' |
|
|
form_class = f.NahrajReseniForm |
|
|
form_class = f.NahrajReseniForm |
|
|
|
|
|
nadproblem: m.Problem |
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
def setup(self, request, *args, **kwargs): |
|
|
# Zaříznutí nezadaných problémů |
|
|
super().setup(request, *args, **kwargs) |
|
|
nadproblem_id = self.kwargs["nadproblem_id"] |
|
|
nadproblem_id = self.kwargs["nadproblem_id"] |
|
|
self.nadproblem = get_object_or_404(m.Problem, id=nadproblem_id) |
|
|
self.nadproblem = get_object_or_404(m.Problem, id=nadproblem_id) |
|
|
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
|
# Zaříznutí nezadaných problémů |
|
|
if self.nadproblem.stav != m.Problem.STAV_ZADANY: |
|
|
if self.nadproblem.stav != m.Problem.STAV_ZADANY: |
|
|
raise PermissionDenied() |
|
|
raise PermissionDenied() |
|
|
|
|
|
|
|
|