1
0
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:
Yohann D'ANELLO
2021-01-22 09:40:28 +01:00
parent 628f69e772
commit ce206998f0
12 changed files with 402 additions and 224 deletions

View File

@ -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.