from flask_wtf import FlaskForm from flask_wtf.file import FileAllowed, FileRequired from wtforms import FileField, SelectField, StringField, SubmitField from wtforms.validators import DataRequired, Length class OCRJobForm(FlaskForm): description = StringField( 'Description', validators=[DataRequired(), Length(1, 64)] ) file = FileField( 'File', validators=[ FileAllowed(['pdf', 'tif', 'tiff']), FileRequired() ] ) language = SelectField( 'Language', choices=[ ('', 'Choose your option'), ('eng', 'English'), ('enm', 'English, Middle (1100-1500)'), ('fra', 'French'), ('frm', 'French, Middle (ca. 1400-1600)'), ('deu', 'German'), ('frk', 'German Fraktur'), ('ita', 'Italian'), ('por', 'Portuguese'), ('spa', 'Spanish; Castilian') ], validators=[DataRequired()] ) submit = SubmitField('Submit')