|
@ -89,6 +89,13 @@ class NahrajReseniForm(forms.ModelForm): |
|
|
if 'problem' in self.fields: |
|
|
if 'problem' in self.fields: |
|
|
self.fields['problem'].label = "Všechny řešené problémy" |
|
|
self.fields['problem'].label = "Všechny řešené problémy" |
|
|
|
|
|
|
|
|
|
|
|
def clean_problem(self): |
|
|
|
|
|
problem = self.cleaned_data.get('problem') |
|
|
|
|
|
for p in problem: |
|
|
|
|
|
if p.stav != m.Problem.STAV_ZADANY: |
|
|
|
|
|
raise forms.ValidationError("Problém " + str(p) + " již nelze řešit!") |
|
|
|
|
|
return problem |
|
|
|
|
|
|
|
|
ReseniSPrilohamiFormSet = inlineformset_factory(m.Reseni,m.PrilohaReseni, |
|
|
ReseniSPrilohamiFormSet = inlineformset_factory(m.Reseni,m.PrilohaReseni, |
|
|
form = NahrajReseniForm, |
|
|
form = NahrajReseniForm, |
|
|
fields = ('soubor','res_poznamka'), |
|
|
fields = ('soubor','res_poznamka'), |
|
|