mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-11 16:40:40 +00:00
Fix problems with new forms
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileField, FileRequired
|
||||
from wtforms import (
|
||||
StringField,
|
||||
@ -6,10 +7,9 @@ from wtforms import (
|
||||
IntegerField
|
||||
)
|
||||
from wtforms.validators import InputRequired, Length
|
||||
from app.forms import NopaqueForm
|
||||
|
||||
|
||||
class CorpusFileBaseForm(NopaqueForm):
|
||||
class CorpusFileBaseForm(FlaskForm):
|
||||
author = StringField(
|
||||
'Author',
|
||||
validators=[InputRequired(), Length(max=255)]
|
||||
@ -41,6 +41,14 @@ class CreateCorpusFileForm(CorpusFileBaseForm):
|
||||
if not field.data.filename.lower().endswith('.vrt'):
|
||||
raise ValidationError('VRT files only!')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'prefix' not in kwargs:
|
||||
kwargs['prefix'] = 'create-corpus-file-form'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class UpdateCorpusFileForm(CorpusFileBaseForm):
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'prefix' not in kwargs:
|
||||
kwargs['prefix'] = 'update-corpus-file-form'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -1,9 +1,9 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField, TextAreaField
|
||||
from wtforms.validators import InputRequired, Length
|
||||
from app.forms import NopaqueForm
|
||||
|
||||
|
||||
class CorpusBaseForm(NopaqueForm):
|
||||
class CorpusBaseForm(FlaskForm):
|
||||
description = TextAreaField(
|
||||
'Description',
|
||||
validators=[InputRequired(), Length(max=255)]
|
||||
@ -13,12 +13,21 @@ class CorpusBaseForm(NopaqueForm):
|
||||
|
||||
|
||||
class CreateCorpusForm(CorpusBaseForm):
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'prefix' not in kwargs:
|
||||
kwargs['prefix'] = 'create-corpus-form'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class UpdateCorpusForm(CorpusBaseForm):
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'prefix' not in kwargs:
|
||||
kwargs['prefix'] = 'update-corpus-form'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class ImportCorpusForm(NopaqueForm):
|
||||
pass
|
||||
class ImportCorpusForm(FlaskForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'prefix' not in kwargs:
|
||||
kwargs['prefix'] = 'import-corpus-form'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
Reference in New Issue
Block a user