|
|
@ -89,6 +89,13 @@ class NahrajReseniForm(forms.ModelForm): |
|
|
|
if 'problem' in self.fields: |
|
|
|
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, |
|
|
|
form = NahrajReseniForm, |
|
|
|
fields = ('soubor','res_poznamka'), |
|
|
|