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