diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index 14639b65..0f243f82 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -87,7 +87,7 @@ ReseniSPrilohamiFormSet = inlineformset_factory(m.Reseni,m.PrilohaReseni, class JednoHodnoceniForm(forms.ModelForm): class Meta: model = m.Hodnoceni - fields = ('problem', 'body', 'cislo_body') + fields = ('problem', 'body', 'deadline_body') widgets = { 'problem': autocomplete.ModelSelect2( url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? diff --git a/odevzdavatko/templates/odevzdavatko/detail.html b/odevzdavatko/templates/odevzdavatko/detail.html index 233d703d..b5402001 100644 --- a/odevzdavatko/templates/odevzdavatko/detail.html +++ b/odevzdavatko/templates/odevzdavatko/detail.html @@ -97,13 +97,13 @@ $(document).ready(function(){ {{ form.management_form }} - + {% for subform in form %} - + @@ -118,7 +118,7 @@ $(document).ready(function(){ - +
ProblémBodyČíslo pro body
ProblémBodyDeadline pro body
{{ subform.problem }} {{ subform.body }}{{ subform.cislo_body }}{{ subform.deadline_body }} Smazat
{{ form.empty_form.problem }} {{ form.empty_form.body }}{{ form.empty_form.cislo_body }}{{ form.empty_form.deadline_body }} Smazat
diff --git a/odevzdavatko/templates/odevzdavatko/detail_resitele.html b/odevzdavatko/templates/odevzdavatko/detail_resitele.html index 4e5d7848..c1741f1c 100644 --- a/odevzdavatko/templates/odevzdavatko/detail_resitele.html +++ b/odevzdavatko/templates/odevzdavatko/detail_resitele.html @@ -37,12 +37,12 @@ {# Hodnocení: #}

Hodnocení:

-{# #} +{# #} {% for h in hodnoceni %} -{# #} +{# #} {% endfor %}
ProblémBodyČíslo pro body
ProblémBodyDeadline pro body
{{ h.problem }} {{ h.body }}{{ h.cislo_body }}{{ h.deadline_body }}
diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index 5c1fc5b4..04db1e5b 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -216,12 +216,12 @@ class DetailReseniView(DetailView): def aktualni_hodnoceni(self): self.reseni = get_object_or_404(m.Reseni, id=self.kwargs['pk']) - result = [] # Slovníky s klíči problem, body, cislo_body -- initial data pro f.OhodnoceniReseniFormSet + result = [] # Slovníky s klíči problem, body, deadline_body -- initial data pro f.OhodnoceniReseniFormSet for hodn in m.Hodnoceni.objects.filter(reseni=self.reseni): result.append( {"problem": hodn.problem, "body": hodn.body, - "cislo_body": hodn.cislo_body, + "deadline_body": hodn.deadline_body, }) return result @@ -260,11 +260,11 @@ def hodnoceniReseniView(request, pk, *args, **kwargs): for form in formset: problem = form.cleaned_data['problem'] body = form.cleaned_data['body'] - cislo_body = form.cleaned_data['cislo_body'] + deadline_body = form.cleaned_data['deadline_body'] hodnoceni = m.Hodnoceni( problem=problem, body=body, - cislo_body=cislo_body, + deadline_body=deadline_body, reseni=reseni, ) logger.info(f"Creating Hodnoceni: {hodnoceni}") @@ -285,7 +285,7 @@ class ResitelReseniView(DetailView): { "problem": hodn.problem, "body": hodn.body, - # "cislo_body": hodn.cislo_body, + # "deadline_body": hodn.deadline_body, } ) return result @@ -412,6 +412,7 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): self.object = form.save() self.object.resitele.add(m.Resitel.objects.get(osoba__user = self.request.user)) self.object.cas_doruceni = timezone.now() + self.object.deadline = m.Deadline.objects.filter(deadline__gte=self.object.cas_doruceni).first() self.object.forma = m.Reseni.FORMA_UPLOAD self.object.save()