|
|
@ -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 |
|
|
@ -302,12 +303,16 @@ class NahrajObrazekKTreeNoduForm(forms.ModelForm): |
|
|
|
fields = ('na_web',) |
|
|
|
|
|
|
|
|
|
|
|
OhodnoceniReseniFormSet = inlineformset_factory(m.Reseni, m.Hodnoceni, |
|
|
|
fields = ('problem', 'body', 'cislo_body'), |
|
|
|
extra = 1, |
|
|
|
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, |
|
|
|
) |
|
|
|