forms.py 2.07 KB
from flask.ext.wtf import Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField, FileField, SelectField
from wtforms.validators import Required, Length, Email



choices = ['train','test']

class LoginForm(Form):
	username = StringField('username', validators=[Required(), Length(1, 64)])
	password = PasswordField('password', validators=[Required()])
	#remember_me = BooleanField('Keep me logged in')
	submit = SubmitField('Log In')

class TrainForm(Form):
	type_name = SelectField('type', choices = [('train','train'), ('analysis','analysis')])
	table_name = StringField('table name', validators = [Required(), Length(1,64)])
	img_source = StringField('image directory', validators=[Required(),Length(1,64)])
	model_name = StringField('model name', validators=[Required(),Length(1,64)])
	label_source = StringField('label file',validators=[Required(),Length(1,64)])
	feat_type = StringField('feat type',validators=[Required(),Length(1,64)])

	submit = SubmitField('Run')

class ExportDataForm(Form):
	type_name = SelectField('type', choices = [('all','all'), ('tagged','tagged')])
	table_name = StringField('table name', validators = [Required(), Length(1,64)])
	dst_dir = StringField('dentist image directory', validators=[Required(),Length(1,64)])

	submit = SubmitField('Run')

class SpiderForm(Form):
	spider_source = SelectField('spider source', choices = [('scrapy.cfg.bd','baidu'),('scrapy.cfg.cm','sina')])
	table_name = StringField('table name', validators=[Required(),Length(1,64)])

	submit = SubmitField('Run')

class JumpForm(Form):
	submit = SubmitField('Jump to main')

class JumpSpiderExportForm(Form):
	type_name = SelectField('type', choices = [('spider','spider'), ('export','export')])
	submit = SubmitField('Jump')


# class TestForm(Form):
# 	table_name = StringField('table name', validators = [Required(), Length(1,64)])
# 	img_source = StringField('test directory', validators=[Required(),Length(1,64)])
# 	model = SelectField('model', choices=list(choices))
# 	dst_dir = StringField('dst directory', validators=[Required(),Length(1,64)])
# 	submit = SubmitField('Run')