mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 01:58:23 +02:00
Syntheses must not exceed 2 pages
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -351,6 +351,10 @@ class SynthesisForm(forms.ModelForm):
|
||||
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."))
|
||||
pdf_reader = PdfReader(file)
|
||||
pages = len(pdf_reader.pages)
|
||||
if pages > 2:
|
||||
raise ValidationError(_("The PDF file must not have more than 2 pages."))
|
||||
return self.cleaned_data["file"]
|
||||
|
||||
def save(self, commit=True):
|
||||
|
Reference in New Issue
Block a user