|
@ -2,7 +2,7 @@ from django.views.generic import ListView, DetailView, FormView |
|
|
from django.views.generic.list import MultipleObjectTemplateResponseMixin,MultipleObjectMixin |
|
|
from django.views.generic.list import MultipleObjectTemplateResponseMixin,MultipleObjectMixin |
|
|
from django.views.generic.base import View |
|
|
from django.views.generic.base import View |
|
|
from django.views.generic.detail import SingleObjectMixin |
|
|
from django.views.generic.detail import SingleObjectMixin |
|
|
from django.shortcuts import redirect |
|
|
from django.shortcuts import redirect, get_object_or_404 |
|
|
from django.urls import reverse |
|
|
from django.urls import reverse |
|
|
|
|
|
|
|
|
from dataclasses import dataclass |
|
|
from dataclasses import dataclass |
|
@ -135,8 +135,15 @@ class DetailReseniView(DetailView): |
|
|
template_name = 'seminar/odevzdavatko/detail.html' |
|
|
template_name = 'seminar/odevzdavatko/detail.html' |
|
|
|
|
|
|
|
|
def aktualni_hodnoceni(self): |
|
|
def aktualni_hodnoceni(self): |
|
|
... |
|
|
reseni = get_object_or_404(m.Reseni, id=self.kwargs['pk']) |
|
|
return [] |
|
|
result = [] # Slovníky s klíči problem, body, cislo_body -- initial data pro f.OhodnoceniReseniFormSet |
|
|
|
|
|
for hodn in m.Hodnoceni.objects.filter(reseni=reseni): |
|
|
|
|
|
result.append( |
|
|
|
|
|
{"problem": hodn.problem, |
|
|
|
|
|
"body": hodn.body, |
|
|
|
|
|
"cislo_body": hodn.cislo_body, |
|
|
|
|
|
}) |
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
def get_context_data(self, **kw): |
|
|
def get_context_data(self, **kw): |
|
|
ctx = super().get_context_data(**kw) |
|
|
ctx = super().get_context_data(**kw) |
|
|