Pavlovy připomínky k mé předchozí úpravě
This commit is contained in:
parent
65177e53a3
commit
95f8719fe7
2 changed files with 6 additions and 7 deletions
|
@ -970,9 +970,9 @@
|
|||
"insitetree": true,
|
||||
"parent": 37,
|
||||
"sort_order": 50,
|
||||
"title": "Detail řešení {{ reseni_id }}",
|
||||
"title": "Detail řešení {{ reseni.id }}",
|
||||
"tree": 1,
|
||||
"url": "odevzdavatko_detail_reseni reseni_id",
|
||||
"url": "odevzdavatko_detail_reseni reseni.id",
|
||||
"urlaspattern": true
|
||||
},
|
||||
"model": "sitetree.treeitem",
|
||||
|
|
|
@ -188,10 +188,6 @@ class ReseniProblemuView(MultipleObjectTemplateResponseMixin, MultipleObjectMixi
|
|||
jedine_reseni = self.object_list.first()
|
||||
return redirect(reverse("odevzdavatko_detail_reseni", kwargs={"pk": jedine_reseni.id}))
|
||||
context = self.get_context_data()
|
||||
|
||||
context["resitel_id"] = self.kwargs['resitel']
|
||||
context["problem_id"] = self.kwargs['problem']
|
||||
|
||||
return self.render_to_response(context)
|
||||
|
||||
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
|
||||
# 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))}
|
||||
|
||||
# Pro sitetree:
|
||||
ctx["resitel_id"] = self.kwargs['resitel']
|
||||
ctx["problem_id"] = self.kwargs['problem']
|
||||
return ctx
|
||||
|
||||
## 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(
|
||||
initial = self.aktualni_hodnoceni()
|
||||
)
|
||||
ctx['reseni_id'] = self.object.id
|
||||
return ctx
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue