Example #1
0
class addForm(FlaskForm):
    language = core.SelectField(
        label='基础环境镜像:',
        choices=language_choices(),
    )
    pluginname = simple.StringField(
        label='接口名称: ',
        widget=widgets.TextInput(),
        # validators=[DataRequired(message='接口名称不能为空'),
        #                         NoneOf(['t1', 't2', 't10', '3'], message='wuxiao', values_formatter = 'caonima')]
        # render_kw={
        #     "placeholder":"请输入账号!",
        #     "required":'required'               #表示输入框不能为空,并有提示信息
        # }
    )
    inputfilename = simple.StringField(
        label='输入文件名: ',
        widget=widgets.TextInput(),
        # validators=[DataRequired()]
    )
    inputtype = core.SelectMultipleField(
        label='输入数据类型:',
        choices=(('txt', 'txt'), ('world', 'world'), ('jpg', 'jpg'), ('png',
                                                                      'png')),
        default=['txt', 'world', 'jpg', 'png'])
    outputfilename = simple.StringField(label='输出文件名:',
                                        widget=widgets.TextInput())
    outputtype = core.SelectMultipleField(
        label='输出数据类型:',
        choices=(('txt', 'txt'), ('world', 'world'), ('jpg', 'jpg'), ('png',
                                                                      'png')),
        option_widget=widgets.CheckboxInput(),
        default=['txt', 'world', 'jpg', 'png'])
    sources = core.SelectField(label='软件源:',
                               render_kw={'class': 'index-select'},
                               choices=sources_choices())
    textarea = TextAreaField(
        label='接口运行环境:',
        render_kw={'class': 'text-control'},
        # validators=[DataRequired()]
    )
    pluginfile = FileField(
        label='文件选择:',
        # validators=[FileRequired(),
        #                         FileAllowed(['jpg','jpeg','png','gif'])]
    )
    runCommand = simple.StringField(label='运行命令:', widget=widgets.TextInput())
    detail = TextAreaField(
        label='接口描述:',
        render_kw={'class': 'text-detail'},
        # validators=[DataRequired()]
    )
    save = simple.SubmitField('检查')
    pulish = simple.SubmitField('提交')
Example #2
0
class AddCmpInfoForm(FlaskForm):
    name = simple.StringField(
        label="公司名称",
        validators=[
            validators.DataRequired(
                message="用户名不能为空"),  # 必填项检查 message 为返回的错误内容
            validators.length(max=20)
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "name"})

    location = simple.StringField(
        label="公司地址",
        validators=[
            validators.DataRequired(
                message="用户名不能为空"),  # 必填项检查 message 为返回的错误内容
            validators.length(max=20)
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "location"})

    submit = simple.SubmitField(
        label="提交",
        render_kw={
            "class": "btn",
        },
    )
class RequestResetForm(flask_wtf.form.FlaskForm):
    """Class representing the user password reset request form for the
    application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    email = wtforms_core.StringField(
        "Email",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Email(),
        ],
    )
    submit = wtforms_simple.SubmitField("Request password reset")

    def validate_email(self, email):
        """Validate if the given email is still available against the DB

        Parameters
        ----------
        email : string

            email as entered in the form.
        """
        user = flaskblog_user.User.query.filter_by(email=email.data).first()
        if user is None:
            raise wtforms.validators.ValidationError(
                "There is no account with this email. You must register first."
            )
Example #4
0
class RegForm(Form):
    username = simple.StringField(label="用户名:",
                                  validators=[
                                      validators.Length(
                                          min=4,
                                          max=10,
                                          message="用户名不能小于%(min)d,不能大于%(max)d")
                                  ])

    password = simple.PasswordField(
        label="密码:",
        validators=[
            validators.Length(max=10,
                              min=6,
                              message="password不能小于%(min)d,不能大于%(max)d")
        ])

    repassword = simple.PasswordField(
        label="确认眼神:",
        validators=[validators.EqualTo("password", message="眼神未确认")])
    email = simple.StringField(label="邮箱",
                               validators=[validators.Email(message="邮箱格式不符")])

    gender = core.RadioField(label="性别:",
                             choices=[(1, "女"), (2, "男")],
                             coerce=int)

    hobby = core.SelectMultipleField(label="嗜好",
                                     choices=[(1, "小姐姐"), (2, "小萝莉"),
                                              (3, "小正太"), (4, "小哥哥")],
                                     coerce=int)

    sub = simple.SubmitField(label="登陆", render_kw={"class": "bs"})
Example #5
0
class LoginForm(Form):
    username = simple.StringField(
        label="用户名:",
        widget=widgets.TextInput(),
        validators=[
            validators.DataRequired(message="用户名不能为空"),
            validators.Length(min=4,
                              max=10,
                              message="用户名不能小于%(min)d,不能大于%(max)d")
        ],  # 声明校验方式
        id="username",
        #widget=widgets.FileInput(),
        render_kw={"class": "my_class"},
    )

    password = simple.PasswordField(
        label="密码:",
        validators=[
            validators.Length(max=10,
                              min=6,
                              message="password不能小于%(min)d,不能大于%(max)d"),
            validators.Regexp("\d+", message="密码只能是数字")
        ],
        id="pwd",
        render_kw={"style": "width:300px;"})

    sub = simple.SubmitField(label="登陆", render_kw={"class": "bs"})
Example #6
0
class RegistrationForm(Form):
    username = simple.StringField(
        label='Username',
        widget=widgets.TextInput(),
        validators=[
            validators.DataRequired(message="Username can not be empty"),
            validators.Length(6, 40, 'Need to be more than 6 characters')
        ])
    password = simple.PasswordField(
        label='Password',
        widget=widgets.PasswordInput(),
        validators=[
            validators.DataRequired(message='Password can not be empty'),
            validators.Length(6, 40, 'Need to be more than 6 characters')
        ])
    password2 = simple.PasswordField(
        label='Repeat Password',
        widget=widgets.PasswordInput(),
        validators=[
            validators.DataRequired(message='Password can not be empty'),
            validators.EqualTo('password', message='Two password not same')
        ])
    email = simple.StringField(
        label='Email',
        widget=widgets.TextInput(),
        validators=[
            validators.DataRequired(message='Email can not be empty'),
            validators.Email(message='Wrong Email Syntax')
        ])
    submit = simple.SubmitField(label='Submit', widget=widgets.SubmitInput())
Example #7
0
class LoginForm(Form):
    username = simple.StringField(
        label="用户名",
        validators=[validators.data_required(message="用户名不能为空")],
        widget=widgets.TextInput(),
        render_kw={"class": "my_username"})
    password = simple.StringField(
        label="密码",
        validators=[validators.data_required(message="密码不能为空!")],
        widget=widgets.PasswordInput())
    submit = simple.SubmitField(label="提交")
Example #8
0
class LoginForm(Form):
    username = simple.StringField(
        label='Username',
        widget=widgets.TextInput(),
        validators=[validators.DataRequired(message="Username can not be empty")])
    password = simple.PasswordField(
        label='Password',
        widget=widgets.PasswordInput(),
        validators=[validators.DataRequired(message='Password can not be empty')])
    submit = simple.SubmitField(
        label='Submit',
        widget=widgets.SubmitInput()
    )
Example #9
0
class PostForm(flask_wtf.FlaskForm):
    """Class representing the blog post form for the application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    title = wtforms_core.StringField(
        "Title", validators=[wtforms.validators.DataRequired()]
    )
    content = wtforms_simple.TextAreaField(
        "Content", validators=[wtforms.validators.DataRequired()]
    )
    submit = wtforms_simple.SubmitField("Post")
Example #10
0
class ResetPasswordForm(flask_wtf.form.FlaskForm):
    """Class representing the password reset form for the application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    password = wtforms_simple.PasswordField(
        "Password", validators=[wtforms.validators.DataRequired()])
    confirm_password = wtforms_simple.PasswordField(
        "Confirm Password",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.EqualTo("password"),
        ],
    )
    submit = wtforms_simple.SubmitField("Reset password")
Example #11
0
class StudentForm(Form):
    ID = simple.StringField(widget=widgets.HiddenInput),
    StudentName = simple.StringField(
        label="姓名",
        validators=[
            validators.data_required(message="学生姓名不能为空!"),
            validators.Length(min=2, max=20, message="学生姓名长度必须大于2位,小于20位")
        ])
    Age = core.StringField(label="年龄",
                           validators=[
                               validators.data_required(message="学生年龄不能为空!"),
                               validators.Regexp(regex="^\d+$",
                                                 message="学生年龄必须为数字")
                           ])
    Gender = core.RadioField(
        label="性别",
        coerce=int,  # 保存到数据中的值为int类型
        choices=((0, '女'), (1, '男')),
        default=1)
    submit = simple.SubmitField(label="提交")
class LoginForm(flask_wtf.FlaskForm):
    """Class representing the login form for the application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    email = wtforms_core.StringField(
        "Email",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Email(),
        ],
    )
    password = wtforms_simple.PasswordField(
        "Password", validators=[wtforms.validators.DataRequired()]
    )
    remember = wtforms_core.BooleanField("Remember Me")
    submit = wtforms_simple.SubmitField("Login")
Example #13
0
class AddPneInfoForm(FlaskForm):
    model = simple.StringField(
        label="型号",
        validators=[
            validators.DataRequired(
                message="型号不能为空"),  # 必填项检查 message 为返回的错误内容
            validators.length(max=20)
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "model"})

    price = simple.StringField(
        label="价格",
        validators=[
            validators.DataRequired(
                message="价格不能为空"),  # 必填项检查 message 为返回的错误内容
            validators.length(max=20)
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "price"})

    company = simple.StringField(
        label="公司名称",
        validators=[
            validators.DataRequired(
                message="公司名称不能为空"),  # 必填项检查 message 为返回的错误内容
            validators.length(max=20)
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "company"})

    submit = simple.SubmitField(
        label="提交",
        render_kw={
            "class": "btn",
        },
    )
Example #14
0
class LoginForm(FlaskForm):
    username = simple.StringField(
        label="用户名",
        validators=[
            validators.DataRequired(message="用户名不能为空")  # 必填项检查 message 为返回的错误内容
        ],
        widget=widgets.TextInput(),
        render_kw={"class": "form-control"},
        default="wd"
    )
    password = simple.PasswordField(
        label="密码",
        validators=[
            validators.DataRequired(message="密码不能为空"),
            validators.length(6, 10, message='密码长度为6~10位'),
            # Regexp(r'')   # 写正则
        ]
    )
    submit = simple.SubmitField(
        label="提交",
        render_kw={
            "class": "btn btn-primary btn-block",
        },
    )
Example #15
0
class RegistrationForm(Form):
    #def validate_username(self):
        #if not verify_user_register(self.realname.data,self.citizenid.data):
            #raise ValidationError(u'Real Name not match CitizenId')
    username = simple.StringField(
        label='Username',
        widget=widgets.TextInput(),
        validators=[validators.DataRequired(message="Username can not be empty")])
    password = simple.PasswordField(
        label='Password',
        widget=widgets.PasswordInput(),
        validators=[validators.DataRequired(message='Password can not be empty')])
    email = simple.StringField(
        label='Email',
        widget=widgets.TextInput(),
        validators=[validators.DataRequired(message='Email can not be empty'),
                    validators.Email(message='Wrong Email Syntax')])
    phone = simple.StringField(
        label='Phone',
        widget=widgets.TextInput(),
        validators=[validators.DataRequired(message="phone can not be empty")])
    submit = simple.SubmitField(
        label='Submit',
        widget=widgets.SubmitInput())
class UpdateAccountForm(flask_wtf.FlaskForm):
    """Class representing the account update form for the application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    username = wtforms_core.StringField(
        "Username",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Length(min=2, max=20),
        ],
    )
    email = wtforms_core.StringField(
        "Email",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Email(),
        ],
    )
    picture = flask_file.FileField(
        "Update profile picture",
        validators=[flask_file.FileAllowed(["jpg", "png"])],
    )
    submit = wtforms_simple.SubmitField("Update")

    def validate_username(self, username):
        """Validate if the given username is still available against the DB

        Parameters
        ----------
        username : string

            Username as entered in the form.
        """
        if username.data != flask_login.current_user.username:
            user = flaskblog_user.User.query.filter_by(
                username=username.data
            ).first()
            if user:
                raise wtforms.validators.ValidationError(
                    "That username is taken. Please choose a different one"
                )

    def validate_email(self, email):
        """Validate if the given email is still available against the DB

        Parameters
        ----------
        email : string

            email as entered in the form.
        """
        if email.data != flask_login.current_user.email:
            user = flaskblog_user.User.query.filter_by(
                email=email.data
            ).first()
            if user:
                raise wtforms.validators.ValidationError(
                    "That email address is taken. Please choose a different one"
                )
Example #17
0
class manageForm(FlaskForm):
    edit = simple.SubmitField('编辑')
    delete = simple.SubmitField('删除')
    cancel = simple.SubmitField('取消')
    commit = simple.SubmitField('提 交')
    update = simple.SubmitField('从Github更新')
    backup = simple.SubmitField('备份')
    container_add = simple.SubmitField('增加容器')

    plugin = simple.SubmitField('接口管理')
    image = simple.SubmitField('镜像管理')
    container = simple.SubmitField('容器管理')
    sources = simple.SubmitField('软件源管理')
    image_add = simple.SubmitField('镜像添加')
    other_add = simple.SubmitField('其他添加')
Example #18
0
class myForm(FlaskForm):
    sourcefile = FileField(label='选择文件:', validators=[FileAllowed(['txt'])])
    delete = simple.SubmitField('删除')
    add = simple.SubmitField('上传')
    publish = simple.SubmitField('运行')
Example #19
0
class RegistrationForm(flask_wtf.FlaskForm):
    """Class representing the registration form for the application

    Parameters
    ----------
    FlaskForm : WTForms

        Flask wtf class that is extended to create the user login form
    """

    username = wtforms_core.StringField(
        "Username",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Length(min=2, max=20),
        ],
    )
    email = wtforms_core.StringField(
        "Email",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.Email(),
        ],
    )
    password = wtforms_simple.PasswordField(
        "Password", validators=[wtforms.validators.DataRequired()])
    confirm_password = wtforms_simple.PasswordField(
        "Confirm Password",
        validators=[
            wtforms.validators.DataRequired(),
            wtforms.validators.EqualTo("password"),
        ],
    )
    submit = wtforms_simple.SubmitField("Sign Up")

    def validate_username(self, username):
        """Validate if the given username is still available against the DB

        Parameters
        ----------
        username : string

            Username as entered in the form.
        """
        user = flaskblog_user.User.query.filter_by(
            username=username.data).first()
        if user:
            raise wtforms.validators.ValidationError(
                "That username is taken. Please choose a different one")

    def validate_email(self, email):
        """Validate if the given email is still available against the DB

        Parameters
        ----------
        email : string

            email as entered in the form.
        """
        user = flaskblog_user.User.query.filter_by(email=email.data).first()
        if user:
            raise wtforms.validators.ValidationError(
                "That email address is taken. Please choose a different one")
Example #20
0
class Up_file_Foem(Form):
    body = simple.FileField(u'选择上传文件')
    submit = simple.SubmitField(u'开始上传')
Example #21
0
class RegForm(Form):
    username = simple.StringField(
        label="用户名",
        validators=[
            validators.DataRequired(message="不能为空"),
            validators.Length(min=3, max=5, message="不能小于3位,不能大于5位")
        ],
        # widget=widgets.TextInput(),
        render_kw={"class": "my_username"})

    nickname = simple.StringField(
        label="昵称",
        validators=[
            validators.DataRequired(message="不能为空"),
        ],
        # widget=widgets.TextInput(),
        render_kw={"class": "my_username"})

    password = simple.PasswordField(
        label="密码",
        validators=[
            validators.DataRequired(message="不能为空"),
            validators.Length(min=6, max=6, message="密码必须为6位"),
            validators.Regexp(regex="\d+", message="密码必须位数字"),
        ],
        # widget=widgets.TextInput(),
        render_kw={"class": "my_password"})

    repassword = simple.PasswordField(label="重复密码",
                                      validators=[
                                          validators.EqualTo(
                                              fieldname="password",
                                              message="两次密码不一致")
                                      ])

    email = simple.StringField(
        label="昵称",
        validators=[
            validators.Email(message="格式不正确"),
        ],
        # widget=widgets.TextInput(),
        render_kw={"class": "my_username"})

    gender = core.RadioField(label="性别",
                             coerce=int,
                             choices=((1, "女"), (2, "男")),
                             default=1)

    hobby = core.SelectMultipleField(label="爱好",
                                     coerce=int,
                                     choices=(
                                         (1, "小姐姐"),
                                         (2, "小萝莉"),
                                         (3, "小哥哥"),
                                         (4, "小正太"),
                                         (5, "阿姨"),
                                         (6, "大叔"),
                                     ),
                                     default=(1, 2, 5))

    submit = simple.SubmitField(label="提交")
Example #22
0
class fileDownload(FlaskForm):
    alldownloadf = simple.SubmitField('全部下载')
    find = simple.SubmitField('查找')
    downloadf = simple.SubmitField('文件下载')