mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	normalize forms
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
from app.models import Job, TesseractOCRModel
 | 
			
		||||
from app.models import TesseractOCRModel
 | 
			
		||||
from flask_login import current_user
 | 
			
		||||
from flask_wtf import FlaskForm
 | 
			
		||||
from flask_wtf.file import FileField, FileAllowed, FileRequired
 | 
			
		||||
from flask_wtf.file import FileField, FileRequired
 | 
			
		||||
from wtforms import (
 | 
			
		||||
    BooleanField,
 | 
			
		||||
    MultipleFileField,
 | 
			
		||||
@@ -15,24 +15,10 @@ from . import SERVICES
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AddJobForm(FlaskForm):
 | 
			
		||||
    description = StringField('Description', validators=[InputRequired()])  # noqa
 | 
			
		||||
    submit = SubmitField()
 | 
			
		||||
    title = StringField('Title', validators=[InputRequired()])
 | 
			
		||||
    description = StringField('Description', validators=[InputRequired(), Length(min=1, max=255)])
 | 
			
		||||
    title = StringField('Title', validators=[InputRequired(), Length(min=1, max=32)])
 | 
			
		||||
    version = SelectField('Version', validators=[DataRequired()])
 | 
			
		||||
 | 
			
		||||
    def validate_description(self, field):
 | 
			
		||||
        max_length = Job.description.property.columns[0].type.length
 | 
			
		||||
        if len(field.data) > max_length:
 | 
			
		||||
            raise ValidationError(
 | 
			
		||||
                f'Description must be less than {max_length} characters'
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
    def validate_title(self, field):
 | 
			
		||||
        max_length = Job.title.property.columns[0].type.length
 | 
			
		||||
        if len(field.data) > max_length:
 | 
			
		||||
            raise ValidationError(
 | 
			
		||||
                f'Title must be less than {max_length} characters'
 | 
			
		||||
            )
 | 
			
		||||
    submit = SubmitField()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AddFileSetupPipelineJobForm(AddJobForm):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user