|
@ -188,10 +188,6 @@ class ReseniProblemuView(MultipleObjectTemplateResponseMixin, MultipleObjectMixi |
|
|
jedine_reseni = self.object_list.first() |
|
|
jedine_reseni = self.object_list.first() |
|
|
return redirect(reverse("odevzdavatko_detail_reseni", kwargs={"pk": jedine_reseni.id})) |
|
|
return redirect(reverse("odevzdavatko_detail_reseni", kwargs={"pk": jedine_reseni.id})) |
|
|
context = self.get_context_data() |
|
|
context = self.get_context_data() |
|
|
|
|
|
|
|
|
context["resitel_id"] = self.kwargs['resitel'] |
|
|
|
|
|
context["problem_id"] = self.kwargs['problem'] |
|
|
|
|
|
|
|
|
|
|
|
return self.render_to_response(context) |
|
|
return self.render_to_response(context) |
|
|
|
|
|
|
|
|
def get_context_data(self, *args, **kwargs): |
|
|
def get_context_data(self, *args, **kwargs): |
|
@ -200,6 +196,10 @@ class ReseniProblemuView(MultipleObjectTemplateResponseMixin, MultipleObjectMixi |
|
|
# Django má {% regroup %}, ale ten potřebuje, aby klíč byl atribut položky: https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#regroup |
|
|
# Django má {% regroup %}, ale ten potřebuje, aby klíč byl atribut položky: https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#regroup |
|
|
# Takže rozbalíme groupby do slovníku klíč → seznam sami (dictionary comphrehension) |
|
|
# Takže rozbalíme groupby do slovníku klíč → seznam sami (dictionary comphrehension) |
|
|
ctx['reseni_podle_deadlinu'] = {k: list(v) for k,v in groupby(ctx['object_list'], lambda r: deadline(r.cas_doruceni))} |
|
|
ctx['reseni_podle_deadlinu'] = {k: list(v) for k,v in groupby(ctx['object_list'], lambda r: deadline(r.cas_doruceni))} |
|
|
|
|
|
|
|
|
|
|
|
# Pro sitetree: |
|
|
|
|
|
ctx["resitel_id"] = self.kwargs['resitel'] |
|
|
|
|
|
ctx["problem_id"] = self.kwargs['problem'] |
|
|
return ctx |
|
|
return ctx |
|
|
|
|
|
|
|
|
## XXX: https://docs.djangoproject.com/en/3.1/topics/class-based-views/mixins/#avoid-anything-more-complex |
|
|
## XXX: https://docs.djangoproject.com/en/3.1/topics/class-based-views/mixins/#avoid-anything-more-complex |
|
@ -223,7 +223,6 @@ class DetailReseniView(DetailView): |
|
|
ctx['form'] = f.OhodnoceniReseniFormSet( |
|
|
ctx['form'] = f.OhodnoceniReseniFormSet( |
|
|
initial = self.aktualni_hodnoceni() |
|
|
initial = self.aktualni_hodnoceni() |
|
|
) |
|
|
) |
|
|
ctx['reseni_id'] = self.object.id |
|
|
|
|
|
return ctx |
|
|
return ctx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|