diff --git a/apps/participation/forms.py b/apps/participation/forms.py index 1d619d0..b7032cb 100644 --- a/apps/participation/forms.py +++ b/apps/participation/forms.py @@ -119,7 +119,7 @@ class SolutionForm(forms.ModelForm): def clean_file(self): if "file" in self.files: file = self.files["file"] - if file.size > 2e6: + if file.size > 5e6: raise ValidationError(_("The uploaded file size must be under 5 Mo.")) if file.content_type != "application/pdf": raise ValidationError(_("The uploaded file must be a PDF file.")) @@ -179,6 +179,15 @@ class PassageForm(forms.ModelForm): class SynthesisForm(forms.ModelForm): + def clean_file(self): + if "file" in self.files: + file = self.files["file"] + if file.size > 2e6: + raise ValidationError(_("The uploaded file size must be under 2 Mo.")) + if file.content_type != "application/pdf": + raise ValidationError(_("The uploaded file must be a PDF file.")) + return self.cleaned_data["photo_authorization"] + def save(self, commit=True): """ Don't save a synthesis with this way. Use a view instead