From ce6ec4af58401a761576e2107001e4434648beb3 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Thu, 1 Aug 2019 12:16:49 +0200 Subject: [PATCH] Add validator to file upload in corpus creation. --- app/main/forms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 82b3a7c7..d9f369fd 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1,5 +1,5 @@ from flask_wtf import FlaskForm -from wtforms import MultipleFileField, SelectField, StringField, SubmitField +from wtforms import MultipleFileField, StringField, SubmitField from wtforms.validators import DataRequired, Length @@ -8,12 +8,12 @@ class CreateCorpusForm(FlaskForm): 'Description', validators=[DataRequired(), Length(1, 64)] ) - files = MultipleFileField('Files') + files = MultipleFileField('Files', validators=[DataRequired()]) + submit = SubmitField('Create corpus') title = StringField( 'Title', validators=[DataRequired(), Length(1, 32)] ) - submit = SubmitField('Create corpus') ''' def validate_files(form, field): for file in form.files.getlist[field.name]: