diff --git a/seminar/forms.py b/seminar/forms.py index fd380026..c64095c6 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -2,6 +2,7 @@ from django import forms from dal import autocomplete from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.models import User +from django.forms import formset_factory from django.forms.models import inlineformset_factory from .models import Skola, Resitel, Osoba, Problem @@ -301,3 +302,17 @@ class NahrajObrazekKTreeNoduForm(forms.ModelForm): model = m.Obrazek fields = ('na_web',) + +class JednoHodnoceniForm(forms.ModelForm): + class Meta: + model = m.Hodnoceni + fields = ('problem', 'body', 'cislo_body') + widgets = { + 'problem': autocomplete.ModelSelect2( + url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? + ) + } + +OhodnoceniReseniFormSet = formset_factory(JednoHodnoceniForm, + extra = 0, + ) diff --git a/seminar/templates/seminar/odevzdavatko/detail.html b/seminar/templates/seminar/odevzdavatko/detail.html index 6cee990d..6344e0a5 100644 --- a/seminar/templates/seminar/odevzdavatko/detail.html +++ b/seminar/templates/seminar/odevzdavatko/detail.html @@ -2,6 +2,59 @@ {% block content %} +{# FIXME: Necopypastovat! Tohle je zkopírované ze static/seminar/dynamic_formsets.js #} + + +
Řešené problémy: {{ object.problem.all | join:", " }}
Řešitelé: {{ object.resitele.all | join:", " }}
@@ -27,21 +80,33 @@ {% endif %} {# Hodnocení: #} -{# FIXME: Udělat jako formulář #}