mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-04 07:32:18 +02:00
Teams must send their motivation letter
This commit is contained in:
@ -59,6 +59,21 @@ class ParticipationForm(forms.ModelForm):
|
||||
fields = ('tournament',)
|
||||
|
||||
|
||||
class MotivationLetterForm(forms.ModelForm):
|
||||
def clean_file(self):
|
||||
if "file" in self.files:
|
||||
file = self.files["motivation_letter"]
|
||||
if file.size > 2e6:
|
||||
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
|
||||
if file.content_type not in ["application/pdf", "image/png", "image/jpeg"]:
|
||||
raise ValidationError(_("The uploaded file must be a PDF, PNG of JPEG file."))
|
||||
return self.cleaned_data["motivation_letter"]
|
||||
|
||||
class Meta:
|
||||
model = Team
|
||||
fields = ('motivation_letter',)
|
||||
|
||||
|
||||
class RequestValidationForm(forms.Form):
|
||||
"""
|
||||
Form to ask about validation.
|
||||
|
Reference in New Issue
Block a user