nopaque/app/services/forms.py
2019-08-01 08:22:17 +02:00

36 lines
1.0 KiB
Python

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')