|
@ -2,6 +2,7 @@ from django import forms |
|
|
from dal import autocomplete |
|
|
from dal import autocomplete |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.contrib.auth.models import User |
|
|
from django.contrib.auth.models import User |
|
|
|
|
|
from django.forms import formset_factory |
|
|
from django.forms.models import inlineformset_factory |
|
|
from django.forms.models import inlineformset_factory |
|
|
|
|
|
|
|
|
from .models import Skola, Resitel, Osoba, Problem |
|
|
from .models import Skola, Resitel, Osoba, Problem |
|
@ -302,12 +303,16 @@ class NahrajObrazekKTreeNoduForm(forms.ModelForm): |
|
|
fields = ('na_web',) |
|
|
fields = ('na_web',) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OhodnoceniReseniFormSet = inlineformset_factory(m.Reseni, m.Hodnoceni, |
|
|
class JednoHodnoceniForm(forms.ModelForm): |
|
|
fields = ('problem', 'body', 'cislo_body'), |
|
|
class Meta: |
|
|
extra = 1, |
|
|
model = m.Hodnoceni |
|
|
|
|
|
fields = ('problem', 'body', 'cislo_body') |
|
|
widgets = { |
|
|
widgets = { |
|
|
'problem': autocomplete.ModelSelect2( |
|
|
'problem': autocomplete.ModelSelect2( |
|
|
url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? |
|
|
url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OhodnoceniReseniFormSet = formset_factory(JednoHodnoceniForm, |
|
|
|
|
|
extra = 0, |
|
|
) |
|
|
) |
|
|