Exemple #1
0
class PhotoForm(Form):
    photo = FileField("上传图片!",
                      validators=[
                          FileRequired(),
                          FileAllowed(['jpg', 'png', 'gif'], '只能传jpg,png,gif')
                      ])
    submit = SubmitField('上传')
Exemple #2
0
class AvatarForm(Form):
    avatar = FileField('avatar',
                       validators=[
                           FileRequired(),
                           FileAllowed(['jpg', 'png'], 'Images only!')
                       ])
    submit = SubmitField()
Exemple #3
0
class Register(FlaskForm):
    username = StringField(
        '用户名',
        validators=[DataRequired(),
                    Length(6, 10, message='长度为6到10个字符之间')])
    password = PasswordField(
        '密码',
        validators=[DataRequired(),
                    Length(6, 10, message='密码必须是6到10位字符')])
    password_confirm = PasswordField(
        '确认密码', validators=[EqualTo('password', message='两次输入密码不同')])
    email = StringField('邮箱', validators=[Email(message='请输入正确到邮箱地址')])
    verify_code = StringField(
        '验证码', validators=[DataRequired(),
                           Length(4, 4, message='请输入4位数验证码')])
    icon = FileField('头像',
                     validators=[
                         FileRequired(message='请选择上传的头像'),
                         FileAllowed(photos, message='只能上传图片')
                     ])
    submit = SubmitField('立即注册')

    # 自定义表单验证
    def validate_username(self, field):
        user = User.query.filter_by(username=field.data)
        if user.first():
            # raise 是引发异常 后面跟error名称
            raise ValidationError('该用户已存在')

    def validate_email(self, field):
        email = User.query.filter_by(email=field.data)
        if email.first():
            raise ValidationError('该邮箱已被注册')
Exemple #4
0
class UploadForm(Form):
    '''
    Form to upload SCARF results and package source
    '''
    parsed_results = FileField(
        'Select parsed results XML file',
        validators=[FileRequired(), FileAllowed(['xml'])])
    pkg_src_archive = FileField(
        'Select package source archive',
        validators=[FileRequired(),
                    FileAllowed(['zip', 'tar.gz', 'tar'])])
    pkg_short_name = TextField('Package short name', validators=[Required()])
    pkg_version = TextField('Package version', validators=[Required()])
    platform = TextField('Platform', validators=[Required()])

    submit = SubmitField('Submit')
Exemple #5
0
class UploadForm(Form):
    upload = FileField('Upload a file:',
                       validators=[
                           FileRequired(),
                           FileAllowed(app.config['ALLOWED_EXTENSIONS'],
                                       "not allowed")
                       ])
    submit = SubmitField("Upload")
Exemple #6
0
class PhaseOneForm(Form):
    presentation = FileField('Presentation in PDF Format',
                             validators=[
                                 FileRequired(),
                                 FileAllowed(['pdf'],
                                             'Please upload in PDF format.')
                             ])
    submit = SubmitField("Send")
Exemple #7
0
class FinalRoundForm(Form):
    presentation = FileField(
        'Presentation in PDF, PPTX, or PPT Format. Can include video formats M4V and MOV - must wrap everything in a ZIP file.',
        validators=[
            FileRequired(),
            FileAllowed(['pdf', 'pptx', 'ppt', 'zip'],
                        'Please only upload in one of the allowed formats.')
        ])
    submit = SubmitField("Send")
Exemple #8
0
class UploadForm(Form):
    """
    upload file
    """
    file = FileField('Upload', validators=[
        FileAllowed(['csv', 'xls', 'xlsx'], "Format of upload file can't distinguish"),
        FileRequired("no file upload")
        ])
    submit = SubmitField('Upload')
Exemple #9
0
class MyUploadForm(Form):
    """
	Proof of concept form class for image upload by user
	"""
    name = TextField('name', validators=[DataRequired()])

    upload = FileField(
        'image',
        validators=[FileRequired(),
                    FileAllowed(images, 'Images only!')])
class ImportJSonForm(Form):
    """
    Form to import a deck to the application
    """
    file = FileField(validators=[
        FileRequired(),
        FileAllowed(["json", "Json Format only !"])
    ])

    def __init__(self, label=None):
        super().__init__()
        self.file.label = label
Exemple #11
0
class AvatarForm(Form):
    avatar_url = FileField(u'头像图片',
                           validators=[
                               FileRequired(),
                               FileAllowed(['jpg', 'jpeg', 'png'],
                                           u'只能上传jpg,jpeg,png类型图片')
                           ])
    x1 = StringField(u'x1')
    y1 = StringField(u'y1')
    x2 = StringField(u'x2')
    y2 = StringField(u'y2')
    w = StringField(u'w')
    h = StringField(u'h')
Exemple #12
0
class NewPatientForm(Form):
    binding_predictor_choices = {'random': 'Random',
        'netmhccons': 'NetMHCCons',
        'netmhcpan': 'NetMHCPan'}

    display_id = TextField('Patient ID',
        validators=[validators.required(), validators.length(max=1000)])
    vcf_file = FileField('VCF/MAF File',
        validators=[
            FileRequired(),
            FileAllowed(['vcf', 'maf'],
            'Variant file must be VCF or MAF')]
    )
    hla_file = FileField('HLA File',
        validators=[FileRequired(), FileAllowed(['hla'], 'HLA Only')])
    rna_file = FileField('RNA Expression Quantification File',
        validators=[FileAllowed(['txt'], 'TXT Only')])
    binding_predictor = SelectField('MHC Binding Prediction',
        choices=sorted(zip(binding_predictor_choices.keys(),
            binding_predictor_choices.values())),
        validators=[validators.required()])
    submit = SubmitField('Send')
class SignUpForm(Form):
    username = StringField('Username: '******'Firstname: ', validators=[DataRequired()])
    lastname = StringField('Lastname: ', validators=[DataRequired()])
    age = IntegerField('Age: ', validators=[DataRequired()])
    gender = SelectField('Gender: ',
                         choices=[('Male', 'Male'), ('Female', 'Female')])
    image = FileField('Profile Picture: ',
                      validators=[
                          FileRequired(),
                          FileAllowed(['jpg', 'jpeg', 'png', 'gif'],
                                      'Images Only')
                      ])
    userid = HiddenField()
    submit = SubmitField('Submit')
Exemple #14
0
class CreateProductForm(Form):
    name = StringField(validators=[
        Required(),
        Length(1, 50),
    ])
    description = StringField(validators=[
        Required(),
    ])
    cat2_id = IntegerField(validators=[
        Required(),
    ])
    price = DecimalField(validators=[
        Required(),
    ])
    img = FileField(validators=[
        FileRequired(),
    ])
Exemple #15
0
class HistoryForm(Form):
    fileName = FileField(
        'hfile',
        validators=[FileRequired(),
                    FileAllowed(['txt'], 'Text Files Only!')])
    submit = SubmitField("Submit")
Exemple #16
0
class ThemeForm(Form):
    theme = FileField(
        'Theme',
        validators=[FileRequired(),
                    FileAllowed(['zip'], 'Zip files only!')])
    submit = SubmitField('Upload')
Exemple #17
0
class UploadForm(WTFForm):
    logo_image = FileField('logo_image', validators=[FileRequired()])
Exemple #18
0
class CreatePromotionForm(Form):
    img = FileField(validators=[FileRequired(), ])
Exemple #19
0
class CreateTopProjectForm(WTFForm):
    name = StringField('Name', [validators.DataRequired()])
    image = FileField('image', validators=[FileRequired()])
    description = TextAreaField('description', [validators.DataRequired()])
Exemple #20
0
class UploadForm(WTFForm):
    file = FileField('Component file', validators=[FileRequired()])
    """set datarequired validator"""
    version = StringField('version')
Exemple #21
0
class UploadForm(Form):
    file = FileField('file', validators=[FileRequired()])
Exemple #22
0
class CreateLookupvalueForm(Form):
    lookupvalue_file = FileField(u"上传经销商信息:", validators=[FileRequired()])
    update = SubmitField(u"更新")
Exemple #23
0
class ImportForm(Form):
    atom_file = FileField('depuis un fichier Atom, une sauvegarde blogmarks.net', [FileRequired(), FileAllowed(['xml'], 'Fichier XML uniquement !')])