Beispiel #1
0
    def process_formdata(self, valuelist):
        if valuelist:
            int_str = ' '.join(valuelist)

            if int_str == '' and self.empty_to_none:
                self.data = None
                return

            return IntegerField.process_formdata(self, valuelist)
class DaysForm(FlaskForm):
    days = IntegerField('days', validators=[InputRequired(), Length(min=1)])
Beispiel #3
0
class ValuesForm(Form):
    sales_amount = IntegerField('Sales', validators=[DataRequired()])
    cost = IntegerField('Cost of goods sold', validators=[DataRequired()])
    expenses = IntegerField('Expenses', validators=[DataRequired()])
    tax = IntegerField('Tax', validators=[DataRequired()])
    submit = SubmitField('Submit')
Beispiel #4
0
class IssueForm(Form):
    amount = IntegerField('Amount')
    submit = SubmitField('Submit')
Beispiel #5
0
class SaveApi(FlaskForm):
    id = StringField()
    title = StringField('标题',
                        validators=[Length(max=100, message="长度小于100个字符")])
    sub_title = StringField('副标题',
                            validators=[Length(max=100, message="长度小于100个字符")])
    kind = IntegerField('类型')
    tags = StringField('标签',
                       validators=[Length(max=500,
                                          message="长度小于500个字符")])  # 标签
    color_tags = StringField(
        '颜色标签', validators=[Length(max=500, message="长度小于500个字符")])  # 颜色标签
    brand_tags = StringField(
        '品牌标签', validators=[Length(max=500, message="长度小于500个字符")])  # 品牌标签
    material_tags = StringField(
        '材质标签', validators=[Length(max=500, message="长度小于500个字符")])  # 材质
    style_tags = StringField(
        '风格标签', validators=[Length(max=500, message="长度小于500个字符")])  # 风格
    technique_tags = StringField(
        '工艺标签', validators=[Length(max=500, message="长度小于500个字符")])  # 工艺
    other_tags = StringField(
        '其它标签', validators=[Length(max=500, message="长度小于500个字符")])  # 其它
    total_tags = StringField('所有标签')  # 所有标签
    url = StringField('原文地址',
                      validators=[Length(max=500,
                                         message="长度小于500字符")])  # 原文地址
    price = StringField()  # 销售价
    currency_type = IntegerField()  # 币种: 1.RMB;2.美元;3.--;
    remark = StringField()
    designer = StringField()
    company = StringField()
    domain = IntegerField()
    info = StringField()
    channel = StringField('渠道',
                          validators=[Length(max=30,
                                             message="长度小于30个字符")])  # 渠道
    brand_id = IntegerField()  # 品牌ID
    evt = IntegerField()  # 来源
    category_id = IntegerField()  # 分类ID
    user_id = IntegerField()
    asset_type = IntegerField()
    asset_ids = StringField()
    cover_id = StringField()
    editor_id = IntegerField()
    is_editor = IntegerField()
    editor_level = IntegerField()
    prize = FieldList(FormField(PrizeForm))
    img_urls = FieldList(StringField())

    def save(self, **param):
        data = self.data
        item = Produce(**data)
        item.save()
        return item
Beispiel #6
0
class NewYarnerForm(Form):
    """ New Yarner form """
    name = StringField('Name', validators=[DataRequired()])
    hibiscus = IntegerField('Hibiscus', validators=[DataRequired()])
    ajax = BooleanField('Ajax', validators=[DataRequired()])
Beispiel #7
0
class InferredSequenceForm(FlaskForm):
    sequence_id = SelectField(
        'sequence_id', [validators.Optional()],
        choices=[],
        description="Identifier of the sequence within the genotype")
    genotype_id = SelectField(
        'genotype_id', [validators.Optional()],
        choices=[],
        description=
        "Identifier of the genotype from which these sequences were inferred")
    seq_accession_no = StringField(
        'Accession Number',
        [validators.Length(max=255), NonEmpty()],
        description=
        "Accession number of the inferred allele within the repository, e.g. BK010573 (NCBI), MK308864 (ENA)"
    )
    seq_record_title = StringField(
        'Record Title', [validators.Length(max=255)],
        description="Title of sequence record in the repository")
    ncbi_hash = HiddenField('ncbi_hash', [validators.Length(max=255)],
                            description="md5 sum of details passed to ncbi")
    deposited_version = StringField(
        'Version', [validators.Length(max=255)],
        description=
        "Version number of the sequence within the repository (e.g. 1)")
    run_ids = StringField(
        'Select sets',
        [validators.Length(max=255), NonEmpty()],
        description=
        "Comma-separated list of accession number(s) of the selected records from the sequencing runs that directly support this inference, e.g. SRR7154792 (NCBI), ERX3006608 (ENA)"
    )
    inferred_extension = BooleanField(
        'Extension?', [],
        description=
        "Checked if the inference reports an extension to a known sequence")
    ext_3prime = TextAreaField(
        '3\'  Extension', [
            ValidNucleotideSequence(ambiguous=False, gapped=True),
            validators.Optional()
        ],
        description="Extending sequence at 3\' end (IMGT gapped)")
    start_3prime_ext = IntegerField(
        '3\' start', [validators.Optional()],
        description=
        "Start co-ordinate of 3\' extension (if any) in IMGT numbering")
    end_3prime_ext = IntegerField(
        '3\' end', [validators.Optional()],
        description=
        "End co-ordinate of 3\' extension (if any) in IMGT numbering")
    ext_5prime = TextAreaField(
        '5\' Extension', [
            ValidNucleotideSequence(ambiguous=False, gapped=True),
            validators.Optional()
        ],
        description="Extending sequence at 5\' end (IMGT gapped)")
    start_5prime_ext = IntegerField(
        '5\' start', [validators.Optional()],
        description=
        "Start co-ordinate of 5\' extension (if any) in IMGT numbering")
    end_5prime_ext = IntegerField(
        '5\' end', [validators.Optional()],
        description=
        "End co-ordinate of 5\' extension (if any) in IMGT numbering")
Beispiel #8
0
class AddSensorForm(FlaskForm):
    name = StringField('name', validators=[InputRequired()])
    stype = StringField('type', validators=[InputRequired()])
    position_x = IntegerField('pos_X', validators=[InputRequired()])
    position_y = IntegerField('pos_Y', validators=[InputRequired()])
Beispiel #9
0
class AddPostForm(BaseForm):
    title = StringField(validators=[InputRequired(message='请输入标题!')])
    content = StringField(validators=[InputRequired(message='请输入内容!')])
    board_id = IntegerField(validators=[InputRequired(message='请输入板块id!')])
Beispiel #10
0
class ReusableForm(Form):
    alpha = IntegerField('Alpha', validators=[validators.optional()])
    input_text = StringField('InputText',
                             validators=[validators.data_required()])
Beispiel #11
0
class AdminAddPaymentForm(FlaskForm):
    price = IntegerField('Price', validators=[DataRequired(), NumberRange(min=0, max=None, message="Price must be greater than 0")])
    submit = SubmitField('Add Payment')
Beispiel #12
0
class RuleEdit2003Form(RuleEditForm):
    # 延迟(1-60)
    HS_RuleDelay = IntegerField('RuleDelay')
    # 敏感度
    HS_Sensitivity = IntegerField('Sensitivity')
Beispiel #13
0
class RuleEdit2018Form(RuleEditForm):
    # 敏感度
    HS_Sensitivity = IntegerField('Sensitivity')
Beispiel #14
0
class RuleEdit2011Form(RuleEditForm):
    # 延迟(1-60)
    HS_RuleDelay = IntegerField('RuleDelay')
Beispiel #15
0
class RuleEdit2119Form(RuleEditForm):
    # 延迟(1-60)
    HS_RuleDelay = IntegerField('RuleDelay')
    HS_Height = IntegerField('HS_Height')
Beispiel #16
0
class AddForm(FlaskForm):
    name = StringField('Name of Owner:')
    pup_id = IntegerField('id of puppy: ')
    submit = SubmitField('Add Owner')
Beispiel #17
0
class AddCommentForm(BaseForm):
    content = StringField(validators=[InputRequired(message='请输入评论内容!')])
    post_id = IntegerField(validators=[InputRequired(message='请输入帖子id!')])
Beispiel #18
0
class BuyForm(FlaskForm):
    id = StringField('编号')
    name = StringField('书名')
    author = StringField('作者')
    storage = IntegerField('库存')
    submit = SubmitField('提交')
Beispiel #19
0
class FileForm(Form):
    file_upload_max_size = IntegerField(_('max file size'))
    file_upload_allowed_extension = StringField('allowed file extensions')
Beispiel #20
0
class UseInviteCodeForm(FlaskForm):
    """ Enable/Use an invite code to register """
    enableinvitecode = BooleanField('Enable invite code to register')
    minlevel = IntegerField("Minimum level to create invite codes")
    maxcodes = IntegerField("Max amount of invites per user")
Beispiel #21
0
class MazeGeneratorForm(FlaskForm):
    """Форма для задания параметров генерируемого лабиринта"""
    width = IntegerField(validators=[DataRequired()])
    height = IntegerField(validators=[DataRequired()])
    submit = SubmitField("Generate Maze")
Beispiel #22
0
class PrizeForm(FlaskForm):
    id = IntegerField('ID')
    level = StringField('level')
    time = StringField('time')
    name = StringField('name')
Beispiel #23
0
class EconomicValidate(Form):
    city = StringField(validators=[DataRequired(message='城市必填')])
    type = IntegerField(validators=[DataRequired(message='类型不能为空')])
    sub_type = IntegerField(validators=[DataRequired(message='类型不能为空')])
Beispiel #24
0
class SaveForm(FlaskForm):
    id = StringField()
    title = StringField('标题',
                        validators=[Length(max=100, message="长度小于100个字符")])
    kind = IntegerField('类型')
    tags = StringField('标签',
                       validators=[Length(max=500,
                                          message="长度小于500个字符")])  # 标签
    color_tags = StringField(
        '颜色标签', validators=[Length(max=500, message="长度小于500个字符")])  # 颜色标签
    brand_tags = StringField(
        '品牌标签', validators=[Length(max=500, message="长度小于500个字符")])  # 品牌标签
    material_tags = StringField(
        '材质标签', validators=[Length(max=500, message="长度小于500个字符")])  # 材质
    style_tags = StringField(
        '风格标签', validators=[Length(max=500, message="长度小于500个字符")])  # 风格
    technique_tags = StringField(
        '工艺标签', validators=[Length(max=500, message="长度小于500个字符")])  # 工艺
    other_tags = StringField(
        '其它标签', validators=[Length(max=500, message="长度小于500个字符")])  # 其它
    total_tags = StringField('所有标签')  # 所有标签
    url = StringField('原文地址',
                      validators=[Length(max=500,
                                         message="长度小于500字符")])  # 原文地址
    price = StringField()  # 销售价
    currency_type = IntegerField()  # 币种: 1.RMB;2.美元;3.--;
    remark = StringField()
    designer = StringField()
    company = StringField()
    domain = IntegerField()
    info = StringField()
    channel = StringField('渠道',
                          validators=[Length(max=30,
                                             message="长度小于30个字符")])  # 渠道
    brand_id = IntegerField()  # 品牌ID
    evt = IntegerField()  # 来源
    category_id = IntegerField()  # 分类ID
    user_id = IntegerField()
    asset_type = IntegerField()
    asset_ids = StringField()
    cover_id = StringField()
    editor_id = IntegerField()
    is_editor = IntegerField()
    editor_level = IntegerField()
    edit_on = IntegerField()
    prize = FieldList(FormField(PrizeForm))

    def update(self):
        id = self.data['id']
        item = Produce.objects(_id=ObjectId(id)).first()
        if not item:
            raise ValueError('产品不存在!')
        data = self.data

        data.pop('id')
        if 'total_tags' in data:
            data.pop('total_tags')

        if 'is_editor' in data and data['is_editor'] == 1:
            data['editor_id'] = g.user._id
            data['editor_level'] = 1
            data['edit_on'] = int(time.time())

        data.pop('user_id')
        data.pop('is_editor')
        data.pop('asset_type')
        data.pop('asset_ids')
        # data.pop('csrf_token')
        ok = item.update(**data)
        return ok

    def save(self, **param):
        data = self.data
        asset_ids = data['asset_ids']
        if data['url']:
            if Produce.objects(url=data['url']).first():
                raise ValueError('产品已存在!')
        if 'is_editor' in data and data['is_editor'] == 1:
            data['editor_id'] = g.user._id
            data['editor_level'] = 1
            data['edit_on'] = int(time.time())
        data['user_id'] = g.user._id
        data.pop('asset_ids')
        data.pop('asset_type')
        data.pop('is_editor')
        data.pop('id')
        if 'total_tags' in data:
            data.pop('total_tags')
        item = Produce(**data)
        ok = item.save()
        if not ok:
            raise ValueError('保存失败!')

        # 更新附件
        if asset_ids:
            asset_arr = asset_ids.strip().split(',')
            for asset_id in asset_arr:
                try:
                    image = Image.objects(_id=ObjectId(asset_id)).first()
                    if image:
                        image.update(target_id=str(item._id))
                except (Exception) as e:
                    continue
        return item
Beispiel #25
0
class AddOwnerForm(FlaskForm):
    name = StringField('Name of Owner: ')
    pup_id = IntegerField("Id of Puppy: ")
    submit = SubmitField("Add Owner")
class Searchform(Form):
    q = StringField(validators=[DataRequired(), Length(min=1, max=30)])
    page = IntegerField(validators=[NumberRange(min=1, max=99)], default=1)
Beispiel #27
0
class DelForm(FlaskForm):

    id = IntegerField('ID Number of Puppy to Remove: ')


    submit = SubmitField('Remove Puppy')
Beispiel #28
0
class AgeForm(FlaskForm):
    age = IntegerField("How old are you?", validators=[DataRequired()])
    submit = SubmitField("Submit")
Beispiel #29
0
class NewReading(FlaskForm):
    #date = DateField('Date', format='%Y-%m-%d', validators=[InputRequired()]) #difficult to enter day without from wtforms.fields.html5 import DateField
    systolic = IntegerField('Systolic', validators=[InputRequired(),NumberRange(min=60, max=160, message="This value must be between 60 to 160.")])
    diastolic = IntegerField('Diastolic', validators=[InputRequired(), NumberRange(min=50, max=140, message="This value must be between 50 to 140")])
    notes = TextAreaField('Notes', validators=[InputRequired(), Length(max=120)])
    submit = SubmitField('Add Reading')
Beispiel #30
0
class EditReading(FlaskForm):
    systolic = IntegerField('Systolic', validators=[InputRequired(),NumberRange(min=60, max=160, message="This value must be between 60 to 160.")])
    diastolic = IntegerField('Diastolic', validators=[InputRequired(), NumberRange(min=50, max=140, message="This value must be between 50 to 140")])
    notes = TextAreaField('Notes', validators=[InputRequired(), Length(max=120)])
    submit = SubmitField('Edit Reading')
Beispiel #31
0
class ParameterForm(FlaskForm):
    # 协议类型
    protocolTypes = find_sysparam_by_type(2)
    protocolTypeList, protocolTypeDefaultValue = convertRadioFormData(
        protocolTypes)
    protocolType = RadioField('protocolType', choices=protocolTypeList)

    # 设备名称
    deviceName = StringField('deviceName',
                             validators=[InputRequired(message=u'设备名称不能为空!')])
    # 设备编号
    deviceNum = StringField('deviceNum')
    # 设备型号
    deviceType = StringField('deviceType')
    # 设备序列号
    deviceSerialNum = StringField('deviceSerialNum')
    # 主控版本
    masterVersion = StringField('masterVersion')
    # 编码版本
    codeVersion = StringField('codeVersion')
    # 通道个数
    channelCount = StringField('channelCount')

    # 设备IPv4地址
    ipAddress = StringField('ipAddress')
    # IPv4子网掩码
    subnetMask = StringField('subnetMask')
    # IPv4默认网关
    defaultGateway = StringField('defaultGateway')

    # HTTP端口
    httpPort = StringField('httpPort',
                           validators=[DataRequired(message=u'HTPP 端口不能为空!')])
    # RTSP端口
    rtspPort = StringField('rtspPort',
                           validators=[DataRequired(message=u'RTSP 端口不能为空!')])
    # HTTPS端口
    httpsPort = StringField(
        'httpsPort', validators=[DataRequired(message=u'HTTPS 端口不能为空!')])

    # 码流类型
    codeStreamTypes = find_sysparam_by_type(13)
    codeStreamTypeList, codeStreamTypeDefaultValue = convertRadioFormData(
        codeStreamTypes)
    codeStreamType = RadioField('codeStreamType', choices=codeStreamTypeList)

    # 分辨率
    screenResolutions = find_sysparam_by_type(14)
    screenResolutionList, screenResolutionDefaultValue = convertRadioFormData(
        screenResolutions)
    screenResolution = RadioField('screenResolution',
                                  choices=screenResolutionList)

    # 码率类型
    codeRateTypes = find_sysparam_by_type(15)
    codeRateTypeList, codeRateTypeDefaultValue = convertRadioFormData(
        codeRateTypes)
    codeRateType = RadioField('codeRateType', choices=codeRateTypeList)

    # 视频帧率
    videoFrameRate = IntegerField(
        'videoFrameRate',
        validators=[NumberRange(min=1, max=25, message=u'范围只能在 1-25')])

    # 视频编码
    videoCodings = find_sysparam_by_type(17)
    videoCodingList, videoCodingDefaultValue = convertRadioFormData(
        videoCodings)
    videoCoding = RadioField('videoCoding', choices=videoCodingList)