Esempio n. 1
0
    def run(cls):
        global association_dict
        if single_item:
            setattr(cls, single_item, createField(yml_field))
        else:
            for i in yml_field:
                try:
                    association = association_dict[i]['association']
                except:
                    association = ''
                if i=='property_type' and yml_field[i]=='container-property':
                    pass
                elif 'property_type' in yml_field[i]:

                    if 'property_type' in yml_field[i] and yml_field[i]['property_type']=='container-property':
                        if association:
                            setattr(cls, i, fields.BooleanField(description={'association':association}))
                        else:
                            setattr(cls, i, fields.BooleanField())
                        populate_fields(yml_field[i],single_item,parent=i)(cls)
                        association_dict = {}
                    else:
                        if parent:
                            setattr(cls, parent+'__'+i, createField(yml_field[i],parent=parent,name=i))
                        else:
                            setattr(cls, i, createField(yml_field[i],parent=parent,name=i))
                else:
                    if parent:
                        setattr(cls, i, fields.BooleanField(description={'association':association,'parent':parent}))
                    else:
                        setattr(cls, i, fields.BooleanField(description={'association':association}))
                    populate_fields(yml_field[i],single_item,parent=i)(cls)
        return cls
Esempio n. 2
0
class UserForwardForm(flask_wtf.FlaskForm):
    forward_enabled = fields.BooleanField(_('Enable forwarding'))
    forward_keep = fields.BooleanField(_('Keep a copy of the emails'))
    forward_destination = fields.StringField(
        _('Destination'),
        [validators.Optional(), validators.Email()])
    submit = fields.SubmitField(_('Update'))
Esempio n. 3
0
class AddPageForm(Form):
    date_added = fields.DateField('Publish On:',format="%m-%d-%Y",widget=DateWidget())
    date_end = fields.DateField('Expire On:',format="%m-%d-%Y",validators=[validators.Optional()],widget=DateWidget())
    name = fields.StringField('Page Name',validators=[validators.InputRequired()])
    description = fields.TextAreaField('Description',validators=[validators.Optional()])
    slug = fields.StringField('Page Slug',validators=[validators.InputRequired()])
    short_url = fields.StringField('Url',validators=[validators.Optional()])
    title = fields.StringField('Page Title',validators=[validators.InputRequired()])
    add_to_nav = fields.BooleanField('Add to Navbar')
    add_sidebar = fields.BooleanField('Add Sidebar')
    visible = fields.SelectField(choices=((1,'Publish'),(0,'Draft')))
    meta_title = fields.StringField('Meta Title',validators=[validators.InputRequired()])
    content = CodeMirrorField('Content',language='xml',config={'lineNumbers':'true'})
    template = fields.FormField(BaseTemplateForm,label="Template",separator='_')
    blocks = fields.SelectMultipleField(label="blocks",choices=[('a','a'),('b','b'),('c','c')])
    category = QuerySelectField('category')
    tags = TagField('Tags')
    use_base_template = fields.BooleanField('Use Base Template')
    base_template =  fields.SelectField(
                        'base template',validators=[
                            validators.InputRequired()
                        ],choices=[
                            (x,x) for x in sorted(get_page_templates()) \
                            if not x.startswith('_') and not \
                            x.startswith('.') and x.endswith('.html')
                        ]
    )
    submit = fields.SubmitField('Save')
class ScriptEditForm(BaseForm):
    
    codes_content = fields.TextAreaField(_('Code Content'), [validators.Required(), validators.Length(max=65536)])
    script_url_ext = fields.TextField(_('Host at /pub/'))
    show_source = fields.BooleanField(_('Show source code when run by public'))
    html_output = fields.BooleanField(_('HTML console output'))
    pass
Esempio n. 5
0
class ActionForm(BaseForm):

    field = fields.SelectField('Field', coerce=int)
    is_required = fields.BooleanField('Required')
    is_visible = fields.BooleanField('Visible')
    disable_form = fields.BooleanField('Disable form')

    def __init__(self, *args, **kwargs):
        super(ActionForm, self).__init__(*args, **kwargs)
        query = (CustomField.query.filter_by(
            meeting_id=g.meeting.id).filter_by(
                custom_field_type=g.rule_type).filter_by(
                    required=False).for_registration().order_by(
                        CustomField.sort))
        self.field.choices = [(c.id, c) for c in query]
        self.cf = None
        if self.field.data:
            self.cf = (CustomField.query.filter_by(id=self.field.data,
                                                   meeting=g.meeting).one())

    def save(self, rule):
        action = Action(rule=rule, field=self.cf)
        action.is_required = self.is_required.data
        action.is_visible = self.is_visible.data
        action.disable_form = self.disable_form.data
        db.session.add(action)
Esempio n. 6
0
class CaptureRateForm(Form):
    pokemon = PokedexLookupField(u'Wild Pokémon', [wtforms.validators.Required()], valid_type='pokemon')
    current_hp = fields.IntegerField(u'% HP left', [wtforms.validators.NumberRange(min=1, max=100)],
                                     default=100)
    status_ailment = fields.SelectField('Status ailment',
        choices=[
            ('', u'—'),
            ('PAR', 'PAR'),
            ('SLP', 'SLP'),
            ('PSN', 'PSN'),
            ('BRN', 'BRN'),
            ('FRZ', 'FRZ'),
        ],
        default=u'',
    )

    ### Extras
    level = OptionalLevelField(u'Wild Pokémon\'s level', default=u'')
    your_level = OptionalLevelField(u'Your Pokémon\'s level', default=u'')
    terrain = fields.SelectField(u'Terrain',
        choices=[
            ('land',    u'On land'),
            ('fishing', u'Fishing'),
            ('surfing', u'Surfing'),
        ],
        default='land',
    )
    twitterpating = fields.BooleanField(u'Wild and your Pokémon are opposite genders AND the same species')
    caught_before = fields.BooleanField(u'Wild Pokémon is in your Pokédex')
    is_dark = fields.BooleanField(u'Nighttime or walking in a cave')

    # ...
    is_pokemon_master = fields.BooleanField(u'Holding Up+B')
Esempio n. 7
0
class InstanceLauncherForm(BaseForm):
    flavor = fields.SelectField('Flavor')
    wisp = fields.SelectField('Wisp')
    cloud = fields.SelectField('Cloud')
    callback_url = fields.TextField('Callback URL')
    require_ipv4 = fields.BooleanField('Require Public IPv4')
    require_ipv6 = fields.BooleanField('Require Public IPv4')
Esempio n. 8
0
class UserSettingsForm(flask_wtf.FlaskForm):
    displayed_name = fields.StringField(_('Displayed name'))
    spam_enabled = fields.BooleanField(_('Enable spam filter'))
    spam_threshold = fields_.IntegerSliderField(_('Spam filter tolerance'))
    forward_enabled = fields.BooleanField(_('Enable forwarding'))
    forward_keep = fields.BooleanField(_('Keep a copy of the emails'))
    forward_destination = fields.StringField(_('Destination'), [validators.Optional(), MultipleEmailAddressesVerify()])
    submit = fields.SubmitField(_('Save settings'))
Esempio n. 9
0
class PostsForm(form.Form):
    title = fields.StringField('标题', validators=[DataRequired('标题不能为空')])
    reward = fields.IntegerField('悬赏')
    comment_count = fields.IntegerField('回帖数')
    is_top = fields.BooleanField('置顶')
    is_cream = fields.BooleanField('加精')
    is_closed = fields.BooleanField('已结')
    form_columns = ('title','reward','comment_count', 'is_top','is_cream', 'is_closed')
Esempio n. 10
0
class UserForm(Form):
    localpart = fields.StringField('E-mail', [validators.DataRequired()])
    pw = fields.PasswordField('Password', [validators.DataRequired()])
    pw2 = fields.PasswordField('Confirm password', [validators.EqualTo('pw')])
    quota_bytes = fields_.IntegerSliderField('Quota', default=1000000000)
    enable_imap = fields.BooleanField('Allow IMAP access', default=True)
    enable_pop = fields.BooleanField('Allow POP3 access', default=True)
    comment = fields.StringField('Comment')
    submit = fields.SubmitField('Save')
Esempio n. 11
0
class ResourcesForm(Form): 
    resource_name = fields.StringField()
    on_get = fields.BooleanField()
    on_post = fields.BooleanField()
    on_put = fields.BooleanField()
    on_del = fields.BooleanField()
    on_get_by_identifier = fields.BooleanField()
    identifier = fields.StringField()
    project_id = QuerySelectField(query_factory=Project.query.all)
Esempio n. 12
0
class ColumnsForm(Form):    
    column_name = fields.StringField()
    column_type = fields.StringField()
    column_additional = fields.StringField()
    primary_key = fields.BooleanField()
    foreign_key = fields.BooleanField()
    unique = fields.BooleanField()
    content = fields.StringField()
    model_id = QuerySelectField(query_factory=Models.query.all)
Esempio n. 13
0
class ManageProduct(Form):
    title = fields.TextField('Title:', validators=[validators.required()])
    us_url = fields.TextField('US URL:', validators=[validators.required()])
    uk_url = fields.TextField('UK URL:', validators=[validators.required()])
    doc_url = fields.TextField('Docs URL:', validators=[validators.required()])
    pitchfork_url = fields.TextField('Pitchfork URL:')
    require_region = fields.BooleanField('Require Region:')
    active = fields.BooleanField('Active to Use:')
    db_name = fields.HiddenField()
class LivePythonConsoleForm(BaseForm):
    
    codes_name = fields.TextField(_('Name of Script'), [validators.Required(), validators.Length(max=255)])
    codes_content = fields.TextAreaField(_('Python Code'), [validators.Required(), validators.Length(max=65536)])
    save_to_datastore = fields.BooleanField(_('Save to datastore'))
    show_source = fields.BooleanField(_('Show source code when run by public'))
    html_output = fields.BooleanField(_('HTML console output'))
    script_url_ext = fields.TextField(_('Host at /pub/'))
    pass
Esempio n. 15
0
class FetchForm(flask_wtf.FlaskForm):
    protocol = fields.SelectField(_('Protocol'),
                                  choices=[('imap', 'IMAP'), ('pop3', 'POP3')])
    host = fields.StringField(_('Hostname or IP'))
    port = fields.IntegerField(_('TCP port'))
    tls = fields.BooleanField(_('Enable TLS'))
    username = fields.StringField(_('Username'))
    password = fields.StringField(_('Password'))
    keep = fields.BooleanField(_('Keep emails on the server'))
    submit = fields.SubmitField(_('Submit'))
Esempio n. 16
0
class UserForm(flask_wtf.FlaskForm):
    localpart = fields.StringField(_('E-mail'), [validators.DataRequired(), validators.Regexp(LOCALPART_REGEX)])
    pw = fields.PasswordField(_('Password'), [validators.DataRequired()])
    pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')])
    quota_bytes = fields_.IntegerSliderField(_('Quota'), default=1000000000)
    enable_imap = fields.BooleanField(_('Allow IMAP access'), default=True)
    enable_pop = fields.BooleanField(_('Allow POP3 access'), default=True)
    comment = fields.StringField(_('Comment'))
    enabled = fields.BooleanField(_('Enabled'), default=True)
    submit = fields.SubmitField(_('Save'))
Esempio n. 17
0
class ManageProduct(Form):
    title = fields.TextField('Title:', validators=[validators.required()])
    app_url = fields.TextField('App. URL:', validators=[validators.required()])
    us_api = fields.TextField('US API Endpoint:',
                              validators=[validators.required()])
    uk_api = fields.TextField('UK API Endpoint:',
                              validators=[validators.required()])
    doc_url = fields.TextField('Docs URL:', validators=[validators.required()])
    require_region = fields.BooleanField('Require Region:')
    active = fields.BooleanField('Active to Use:')
Esempio n. 18
0
class TestCaseForm(FlaskForm):
    input_string = fields.TextAreaField("Input Text")
    input_file = fields.FileField("Input File")
    is_inputfile = fields.BooleanField("Is Input File", default=False)

    output_string = fields.TextAreaField("Output Text")
    output_file = fields.FileField("Output File")
    is_outputfile = fields.BooleanField("Is Output File", default=False)

    public = fields.BooleanField("Public", default=False)
Esempio n. 19
0
class FetchForm(flask_wtf.FlaskForm):
    protocol = fields.SelectField(_('Protocol'), choices=[
        ('imap', 'IMAP'), ('pop3', 'POP3')
    ])
    host = fields.StringField(_('Hostname or IP'), [validators.DataRequired()])
    port = fields.IntegerField(_('TCP port'), [validators.DataRequired(), validators.NumberRange(min=0, max=65535)])
    tls = fields.BooleanField(_('Enable TLS'))
    username = fields.StringField(_('Username'), [validators.DataRequired()])
    password = fields.PasswordField(_('Password'))
    keep = fields.BooleanField(_('Keep emails on the server'))
    submit = fields.SubmitField(_('Submit'))
Esempio n. 20
0
class ScheduledMxCheckForm(form.Form):
    id = fields.StringField('编号')
    source = fields.SelectField('来源', choices=scheduled_source)
    rii = fields.BooleanField('必检项RII')
    forceExec = fields.BooleanField('强制执行')
    description = fields.StringField('维修描述')
    interval = InlineFormField(IntervalDescForm, '间隔类型')
    relateDoc = InlineFormField(RelateDocForm, '相关文档')
    remark = fields.StringField('备注')
    accessory = InlineFormField(AccessoryFileForm, '附件')
    etag = fields.HiddenField('etag')
Esempio n. 21
0
class BaseballInput(panels.InputPanel):
    xvar = fields.SelectField(label="X axis",
                              choices=statchoices,
                              default="Hits (H)")
    yvar = fields.SelectField(label="Y axis",
                              choices=statchoices,
                              default="Runs (R)")

    year = fields.IntegerField(label="Year", default=2013)

    linear = fields.BooleanField(label="Linear Fit")
    shownames = fields.BooleanField(label="Show Names")
Esempio n. 22
0
class RequestForm(FlaskForm):
    # object data
    obj_name = fields.StringField('Object Name', [validators.input_required()])
    obj_ra = fields.StringField('RA', [validators.Optional()])
    obj_dec = fields.StringField('DEC', [validators.Optional()])
    typedesig = fields.SelectField('object type',
                                   [validators.input_required()],
                                   coerce=str,
                                   choices=[('f', 'fixed'),
                                            ('v', 'periodic fixed'),
                                            ('e', 'heliocentric elliptical'),
                                            ('h', 'heliocentric hyperbolic'),
                                            ('p', 'heliocentric parabolic'),
                                            ('E', 'geocentric elliptical')])
    # required and optional fields for requests
    allocation = fields.SelectField('allocation', [validators.data_required()],
                                    coerce=int,
                                    choices=[])
    priority = fields.FloatField('priority', [validators.input_required()])
    filters_op = fields.SelectField('filters', [validators.input_required()],
                                    coerce=str,
                                    choices=[(' 1, 1, 1, 1}', 'u-g-r-i'),
                                             (' 0, 1, 1, 1}', "g-r-i")])
    seq_repeats = fields.IntegerField('# of repeats', default=1)
    ifu = fields.BooleanField('IFU image', [validators.Optional()])
    ab = fields.BooleanField('A B pair', [validators.Optional()])
    cadence = fields.FloatField('cadence',
                                default=None,
                                validators=(validators.Optional(), ))
    min_moon_dist = fields.FloatField(
        'minimum moon distance (degrees)',
        validators=(validators.Optional(), validators.number_range(0., 180.)))
    max_moon_illum = fields.FloatField(
        'maximum moon illumination (fractional)',
        validators=(validators.Optional(), validators.number_range(0., 1.)))
    max_cloud_cover = fields.FloatField(
        'maximum cloud cover (fractional)',
        validators=(validators.Optional(), validators.number_range(0., 1.)))
    phasesamples = fields.FloatField('samples per period',
                                     default=None,
                                     validators=(validators.Optional(), ))
    inidate = fields.DateField('start date (Y-m-d)',
                               validators=[validators.input_required()],
                               format='%Y-%m-%d')
    enddate = fields.DateField('end date (Y-m-d)',
                               validators=[validators.input_required()],
                               format='%Y-%m-%d')
    #elliptical = fields.FormField(HeliocentricEllipticalForm, validators=(validators.Optional(),))
    #hyperbolic = fields.FormField(HeliocentricHyperbolicForm, validators=(validators.Optional(),))
    #parabolic = fields.FormField(HeliocentricParabolicForm, validators=(validators.Optional(),))
    #satellite = fields.FormField(EarthSatelliteForm, validators=(validators.Optional(),))
    submit_req = fields.SubmitField('submit request')
Esempio n. 23
0
class EditGroupForm(BaseForm):
    name = fields.TextField(_('Name'), [
        validators.Length(
            max=FIELD_MAXLENGTH,
            message=_("Field cannot be longer than %(max)d characters.")),
        validators.regexp(
            utils.NAME_LASTNAME_REGEXP,
            message=_("Name invalid. Use only letters and numbers."))
    ])
    can_view = fields.BooleanField(_('Can View'))
    can_edit = fields.BooleanField(_('Can Edit'))
    can_upload = fields.BooleanField(_('Can Upload'))
    can_administer = fields.BooleanField(_('Can Admin'))
Esempio n. 24
0
 class form_class(form.Form):
     network = fields.StringField(widget=widgets.TextArea())
     normalize = fields.BooleanField(label="Normalize weights")
     qualabel = fields.BooleanField(label="Include quality in label")
     predlabel = fields.BooleanField(label="Include predicate in label")
     collapse = fields.BooleanField(label="Collapse arrows between nodes")
     nosubgraphs = fields.BooleanField(
         label="Don't make subgraphs per source")
     #blue = fields.BooleanField()
     #bw = fields.BooleanField(label="Black & White")
     delimiter = fields.SelectField(
         choices=[("", "autodetect"), (";", ";"), (",", ","), ("\t",
                                                               "tab")])
Esempio n. 25
0
class UsersForm(form.Form):
    email = fields.StringField('用户邮箱', validators=[DataRequired('邮箱不能为空'), Email('邮箱格式不正确')])
    username = fields.StringField('昵称', validators=[DataRequired('昵称不能为空')])
    is_active = fields.BooleanField('激活状态')
    is_disabled = fields.BooleanField('禁用')
    is_admin = fields.BooleanField('管理员')
    vip = fields.IntegerField('VIP等级')
    avatar = fields.StringField('头像')
    coin = fields.IntegerField('金币')
    description = fields.TextAreaField('签名')
    city = fields.StringField('城市')
    renzheng = fields.StringField('认证信息')
    form_columns = ('email', 'username', 'is_active', 'is_admin', 'avatar', 'coin', 'description', 'city')
Esempio n. 26
0
class ScheduledMxCheckForm(form.Form):
    id = fields.StringField('编号')
    source = fields.SelectField('来源', choices=bell_scheduled_source)
    ataCode = fields.IntegerField('ATA章节')
    rii = fields.BooleanField('必检项RII')
    forceExec = fields.BooleanField('强制执行')
    startTracking = InlineFormField(TrackingDescForm, '开始跟踪时间点')
    userFlag = fields.BooleanField('用户输入时间点')
    description = fields.StringField('维修描述')
    interval = InlineFormField(IntervalRadioDescForm, '间隔类型')
    relateDoc = InlineFormField(RelateDocForm, '相关文档')
    remark = fields.StringField('备注')
    accessory = InlineFormField(AccessoryFileForm, '附件')
    etag = fields.HiddenField('etag')
Esempio n. 27
0
class RunForm(Form):
    data_url = fields.StringField(**data_url_args)
    data_file = fields.FileField(**data_file_args)
    format = fields.SelectField(**format_args)
    schema_url = fields.StringField(**schema_url_args)
    schema_file = fields.FileField(**schema_file_args)
    schema_eg = fields.SelectField(**schema_eg_args)
    fail_fast = fields.BooleanField(default=False, **fail_fast_args)
    encoding = fields.SelectField(**encoding_args)
    report_type = fields.HiddenField(**report_type_args)
    ignore_empty_rows = fields.BooleanField(default=False,
                                            **ignore_empty_rows_args)
    ignore_duplicate_rows = fields.BooleanField(default=False,
                                                **ignore_duplicate_rows_args)
Esempio n. 28
0
class AccountEditForm(Form):
    """
    Edit user account information
    """
    change_password = fields.BooleanField('Update Password')
    password = fields.PasswordField('New Password', [
        validators.required(),
        validators.EqualTo('verify_password', 'Passwords do not match.'),
        Password('username'),
    ])
    verify_password = fields.PasswordField('Verify Password')
    change_email = fields.BooleanField('Update Email')
    email = fields.StringField('Email')
    regenerate = fields.BooleanField('Regenereate API tokens')
Esempio n. 29
0
class UserForm(form.Form):
    """用户管理表单类"""
    username = fields.StringField('昵称', validators=[DataRequired('昵称不能为空')])
    email = fields.StringField('用户邮箱', validators=[DataRequired('邮箱不能为空'), Email('邮箱格式不正确')])
    is_active = fields.BooleanField('激活状态')
    is_disabled = fields.BooleanField('禁用')
    is_admin = fields.BooleanField('超级用户')
    vip = fields.IntegerField('vip等级')
    avatar = fields.StringField('头像')
    coin = fields.IntegerField('金币')
    description = fields.TextAreaField('描述')
    city = fields.StringField('城市')
    auth_msg = fields.StringField('认证信息')
    role_ids = fields.SelectMultipleField('角色', widget=Select2Widget(multiple=True))
    form_columns = ('username', 'email', 'is_active', 'is_admin', 'avatar', 'coin', 'description', 'city')
Esempio n. 30
0
class AliasForm(flask_wtf.FlaskForm):
    localpart = fields.StringField(_('Alias'), [validators.DataRequired()])
    wildcard = fields.BooleanField(
        _('Use SQL LIKE Syntax (e.g. for catch-all aliases)'))
    destination = DestinationField(_('Destination'))
    comment = fields.StringField(_('Comment'))
    submit = fields.SubmitField(_('Create'))