Upgrade odevzdavatka #30

Merged
zelvuska merged 37 commits from upgrade_odevzdavatka into master 2023-06-19 20:48:30 +02:00
2 changed files with 23 additions and 0 deletions
Showing only changes of commit 512f14ed4d - Show all commits

View file

@ -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'),

View file

@ -30,6 +30,13 @@
{{ field }}
</td>
</tr>
{% if field.errors %}
<tr>
<td colspan="2"><span class="field-error">{{ field.errors }}</span></td>
</tr>
{% endif %}
{% endwith %}
</table>
@ -54,6 +61,13 @@
{{ field }}
</td>
</tr>
{% if field.errors %}
<tr>
<td colspan="2"><span class="field-error">{{ field.errors }}</span></td>
</tr>
{% endif %}
{% endwith %}
</table>
@ -61,6 +75,8 @@
{% include "odevzdavatko/prilohy.html" %}
{{form.non_field_errors}}
<hr>
<h4>Odevzdat řešení</h4>
<input type="submit" value="Odevzdat">