Upgrade odevzdavatka #30
					 2 changed files with 23 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue