Example #1
0
class CompletedMatchRoundForm(Form):
    map_id = SelectField(u'Map',
                         coerce=int,
                         validators=[Required()],
                         choices=[])
    side_id = SelectField(u'Side',
                          coerce=int,
                          validators=[Required()],
                          choices=[])
    gametype_id = SelectField(u'Gametype',
                              coerce=int,
                              validators=[Required()],
                              choices=[])

    wins = IntegerField(u'Wins', validators=[NumberRange(min=0)], default=0)
    losses = IntegerField(u'Losses',
                          validators=[NumberRange(min=0)],
                          default=0)
    draws = IntegerField(u'Draws', validators=[NumberRange(min=0)], default=0)

    players = FieldList(FormField(CompletedMatchPlayerForm))

    def __init__(self, *args, **kwargs):
        kwargs.setdefault('csrf_enabled', False)
        super(CompletedMatchRoundForm, self).__init__(*args, **kwargs)
Example #2
0
class ReleaseEventsAPIForm(Form):
    sent = DateTimeField('Sent:', validators=[InputRequired('Sent is required.')])
    event_name = StringField('Event Name:', validators=[InputRequired('Event Name is required.'), Length(0, 150)])
    platform = StringField('Platform:')
    results = IntegerField('Results:', default=0, validators=[InputRequired('Results is required.')])
    chunkNum = IntegerField('Chunk Number:', default=1)
    chunkTotal = IntegerField('Chunk Total:', default=1)
    group = StringField('Group:', default='other')
Example #3
0
class AddTask(Form):
    task_id = IntegerField('Priority')
    name = TextField('Task Name', validators=[Required()])
    due_date = DateField('Date Due (mm/dd/yyyy)',
                         validators=[Required()],
                         format='%m/%d/%Y')
    priority = SelectField('Priority',
                           validators=[Required()],
                           choices=[('1', '1'), ('2', '2'), ('3', '3'),
                                    ('4', '4'), ('5', '5')])
    status = IntegerField('Status')
Example #4
0
class JobSettingsForm(Form):

    choices = []
    for name in stat.stat_names():
        if name == 'glm':
            for family in stat.glm_families():
                x = name + " (" + family + ")"
                choices.append((x, x))
        else:
            choices.append((name, name))

    statistic = SelectField('Statistic', choices=choices)
    bins = IntegerField('Number of bins',
                        validators=[Required()],
                        default=pade.model.DEFAULT_NUM_BINS)

    permutations = IntegerField('Maximum number of permutations',
                                validators=[Required()],
                                default=pade.model.DEFAULT_NUM_SAMPLES)

    sample_from_residuals = BooleanField(
        'Sample from residuals',
        validators=[Required()],
        default=pade.model.DEFAULT_SAMPLE_FROM_RESIDUALS)

    sample_with_replacement = BooleanField(
        'Use bootstrapping (instead of permutation test)',
        validators=[Required()],
        default=pade.model.DEFAULT_SAMPLE_WITH_REPLACEMENT)

    equalize_means = BooleanField('Equalize means',
                                  validators=[Required()],
                                  default=pade.model.DEFAULT_EQUALIZE_MEANS)

    summary_min_conf_level = FloatField(
        'Minimum confidence level',
        validators=[Required()],
        default=pade.model.DEFAULT_SUMMARY_MIN_CONF)

    summary_step_size = FloatField(
        'Summary step size',
        validators=[Required()],
        default=pade.model.DEFAULT_SUMMARY_STEP_SIZE)

    tuning_params = StringField('Tuning parameters',
                                validators=[Required()],
                                default=' '.join(
                                    map(str,
                                        pade.model.DEFAULT_TUNING_PARAMS)))

    submit = SubmitField()
Example #5
0
class ProductForm(Form):
    name = TextField(
        'name',
        validators=[validators.Required(),
                    validators.Length(min=3, max=64)])
    price = DecimalField(
        'price', validators=[validators.NumberRange(min=0.1, max=100.0)])
    slot = IntegerField('slot',
                        validators=[
                            validators.Required(),
                            validators.NumberRange(min=1, max=5)
                        ])
    stock = IntegerField('stock', validators=[validators.Required()])
    alert_level = IntegerField('alert_level',
                               validators=[validators.Required()])
Example #6
0
class PlayerStatForm(Form):
	goals = IntegerField('Goals', [validators.Optional()],
						  description=u'Goals')
	absence = SelectField('Absence', [validators.Required()],
						  choices=[('False','No'), ('True','Yes')],
						  description=u'Absent')
	goalie_win = SelectField('Goalie Win', [validators.Optional()],
						  choices=[('False','No'),('True','Yes'),],
						  description=u'Goalie Win')
	goalie_loss = SelectField('Goalie Loss', [validators.Optional()],
						  choices=[('False','No'),('True','Yes'),],
						  description=u'Goalie Loss')
	assists= IntegerField('Assists', [validators.Optional()],
						  description=u'Assists')
	submit= SubmitField()
Example #7
0
class GameForm(Form):	
	all_teams = model.current_teams()
		    	
	game_date = DateField('Game Date', [validators.Required(message= (u'Game Date: mm/dd/yyyy'))], 
						 format= '%m/%d/%Y', description=u'Game Date(mm/dd/yyyy)')
	home_team = SelectField('Home', [validators.Required(message=(u'Select Team'))],
							choices=[(str(i.id),i.teamname) for i in all_teams],
							description=u'Home Team')
	away_team = SelectField('Away', [validators.Required(message=(u'Select Team'))],
							choices=[(str(i.id),i.teamname) for i in all_teams],
							description=u'Opponent')
	home_score = IntegerField('Home Score', [validators.Optional()],
						 description=u'Home Score')
	away_score = IntegerField('Away Score', [validators.Optional()],
						 description=u'Opponent Score')
Example #8
0
class LossForm(Form):
    sku = QuerySelectField(u'商品',query_factory=lambda:Sku.query.all(),get_label='name')
    quantity = IntegerField(u'报损数量',[validate_gte_0])
    channel = SelectField(u"损坏渠道", [AnyOf([str(val) for val in LOSS_CHANNELS.keys()])],choices=[(str(val), label) for val, label in LOSS_CHANNELS.items()])
    degree = SelectField(u"损坏情况", [AnyOf([str(val) for val in LOSS_DEGREES.keys()])],choices=[(str(val), label) for val, label in LOSS_DEGREES.items()])
    link_order_id = TextField(u'关联订单号')
    remark = TextAreaField(u'原因备注')
Example #9
0
class EditUserForm(Form):

    # TODO: NAME字段格式检查的中文支持

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    email = TextField(u'Email', validators=[UnChanged()])
    username = TextField(u'Username', validators=[UnChanged()])
    name = TextField(u'Name', description=u'Unique',
                     validators=[Required(message=u'Name is required'),
                                 Regexp(u'^[a-zA-Z0-9\_\-\.\ ]{1,20}$', message=u'Incorrect name format'),
                                 Unique(User, User.name, message=u'The current name is already in use')])
    weixin = TextField(u'Weixin OpenID', description=u'Unique, Using the command <code>openid</code> get in WeiXin',
                       validators=[Optional(),
                                   Unique(User, User.weixin, message=u'The current weixin OpenID is already in use')])
    groups = QuerySelectMultipleField(u'Group', description=u'Multiple Choice',
                                      query_factory=Group.query.all, get_label='desc',
                                      validators=[Required(message=u'Group is required')])
    password = TextField(u'Password', description=u'At least five characters',
                         validators=[Optional(),
                                     Regexp(u'^.{5,20}$', message=u'Password are at least five chars')])
    status = BooleanField(u'Status', description=u'Check to enable this user')

    submit = SubmitField(u'Submit', id='submit')
Example #10
0
class CreateLogin(Form):
    fname = TextField('*First Name', validators=[Required()])
    lname = TextField('Last Name',
                      validators=[Optional(strip_whitespace=True)])
    mobile = TextField(
        'Mobile',
        validators=
        # sets optional entry and strips whitespace
        [
            Optional(strip_whitespace=True),
            v.Length(max=15, message='Mobile exceeds length')
        ])
    zipcode = IntegerField('Zipcode',
                           validators=[Optional(strip_whitespace=True)])
    # v.NumberRange(max=9,
    # message='Zipcode exceeds length')])
    email = TextField('*Email',
                      validators=[
                          Required(),
                          v.Email(),
                          v.EqualTo('confirm_email',
                                    message="Emails must match")
                      ])
    confirm_email = TextField('*Confirm Email')
    bio = TextAreaField('Bio', validators=[Length(min=0, max=140)])
    password = PasswordField('*Password',
                             validators=[
                                 Required(),
                                 v.EqualTo('confirm_password',
                                           message='*Passwords must match')
                             ])
    confirm_password = PasswordField('Confirm Password')
    remember_me = BooleanField('Remember Me', default=False)
    recaptcha = RecaptchaField('*Person Test')
Example #11
0
class ChangePasswordForm(Form):

    # TODO: NAME字段格式检查的中文支持

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    now_password = PasswordField(u'Password')
    new_password = PasswordField(
        u'New Password',
        description=u'At least eight characters',
        validators=[
            Optional(),
            Regexp(u'(^.{8,20}$)|(^$)',
                   message=u'Password are at least eight chars'),
            Depend('now_password',
                   message=u'Password is required when changing password')
        ])
    confirm_password = PasswordField(
        u'Confirm Password',
        description=u'Re-enter the new password',
        validators=[
            Optional(),
            EqualTo('new_password', message=u'New passwords must be the same')
        ])

    submit = SubmitField(u'Submit', id='submit')
Example #12
0
class EditSettingForm(Form):

    # TODO: NAME字段格式检查的中文支持

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    email = TextField(u'Email', validators=[UnChanged()])
    username = TextField(u'Username', validators=[UnChanged()])
    name = TextField(u'Name',
                     description=u'Unique',
                     validators=[
                         Required(message=u'Name is required'),
                         Regexp(u'^[a-zA-Z0-9\_\-\.\ ]{1,20}$',
                                message=u'Incorrect name format'),
                         Unique(User,
                                User.name,
                                message=u'The current name is already in use')
                     ])
    weixin = TextField(
        u'Weixin OpenID',
        description=
        u'Unique, Using the command <code>openid</code> get in WeiXin',
        validators=[
            Optional(),
            Unique(User,
                   User.weixin,
                   message=u'The current weixin OpenID is already in use')
        ])

    submit = SubmitField(u'Submit', id='submit')
Example #13
0
class ProfileForm(Form):
    multipart = True
    next = HiddenField()
    email = EmailField(u'Email', [Required(), Email()])
    # Don't use the same name as model because we are going to use populate_obj().
    avatar_file = FileField(u"Avatar", [Optional()])
    sex_code = RadioField(u"Sex",
                          [AnyOf([str(val) for val in SEX_TYPE.keys()])],
                          choices=[(str(val), label)
                                   for val, label in SEX_TYPE.items()])
    age = IntegerField(u'Age', [Optional(), NumberRange(AGE_MIN, AGE_MAX)])
    phone = TelField(u'Phone', [Length(max=64)])
    url = URLField(u'URL', [Optional(), URL()])
    deposit = DecimalField(
        u'Deposit',
        [Optional(), NumberRange(DEPOSIT_MIN, DEPOSIT_MAX)])
    location = TextField(u'Location', [Length(max=64)])
    bio = TextAreaField(u'Bio', [Length(max=1024)])
    submit = SubmitField(u'Save')

    def validate_name(form, field):
        user = User.get_by_id(current_user.id)
        if not user.check_name(field.data):
            raise ValidationError("Please pick another name.")

    def validate_avatar_file(form, field):
        if field.data and not allowed_file(field.data.filename):
            raise ValidationError("Please upload files with extensions: %s" %
                                  "/".join(ALLOWED_AVATAR_EXTENSIONS))
Example #14
0
class ThreadCrudForm(Form):
    question_id = HiddenField(validators=[Required(),valid_question])
    
    author_id = SelectMultipleField("Author", 
        validators=[check_if_user_does_not_exist])
     
    yesno = SelectField("Yes or No?", 
        validators=[AnyOf(["1","0"]), Required()],
        choices=[("1",'Yes'),("0",'No')])
    
    text = TextAreaField("Opinion", 
        validators=[
            Length(min=1, max=140, 
                message="Post must be between 2 and 140 characters"), 
            Required(), 
            does_not_have_bad_words])
    
    likes = IntegerField("Likes", validators=[Optional()])
    
    def __init__(self, question_id=None, *args, **kwargs):
        super(ThreadCrudForm, self).__init__(*args, **kwargs)
        if question_id:
            self.question_id.data = question_id
        self.author_id.choices = [(str(u.id),'%s (%s)' % (u.username, u.origin)) \
                                  for u in cdw.users.with_fields(isAdmin=True).order_by("+username")]
Example #15
0
class TicketForm(Form):
    id = IntegerField('id')
    project = IntegerField('project', [validators.Required()])
    name = TextField('name', [validators.Required()])
    description = TextField('description', [])
    published = FloatField('published',
                           default=time.mktime(
                               datetime.datetime.now().timetuple()))

    def __init__(self, *args, **kwargs):
        Form.__init__(self, *args, **kwargs)
        self.ticket = None

    def validate(self):
        rs = Form.validate(self)

        return rs
Example #16
0
class SkuForm(Form):
    name = TextField(u'SKU名称',[Required(u'输入SKU名称')])
    item = QuerySelectField(u'商品',query_factory=lambda :Item.query.filter(Item.status==True), get_label='name')
    p1 = TextField(SKU_PROPERTIES_NAME['p1'])
    p2 = TextField(SKU_PROPERTIES_NAME['p2'])
    p3 = TextField(SKU_PROPERTIES_NAME['p3'])
    code = TextField(u'商品条码',[Required(u'商品条码不允许为空')])
    # price = FloatField(u'零售价',[validate_gte_0])
    # market_price = FloatField(u'市场价',[validate_gte_0])
    # discount_price = FloatField(u'活动价',[validate_gte_0],default=0)
    price = FloatField(u'零售价')
    market_price = FloatField(u'市场价')
    discount_price = FloatField(u'活动价')
    allowed_gift = BooleanField(u'是否允许为赠品')
    unit = SelectField(u"单位", [AnyOf(SKU_UNITS)],choices=[(u, u) for u in SKU_UNITS])
    threshold = IntegerField(u'阀值',[validate_gte_0],default=200)
    warning_threshold = IntegerField(u'警戒值',[validate_gte_0],default=500)
    status = BooleanField(u'是否启用',default=True)
Example #17
0
class ProfileForm(Form):
    next = HiddenField()
    name = TextField(
            label = _("Username"),
            validators = [
                Required(),
                Length(USERNAME_LEN_MIN, USERNAME_LEN_MAX),
                ],
            description = u"Combination of letters/digits/underscore, at least %s characters." % USERNAME_LEN_MIN,
            )
    email = EmailField(
            label = _('Email'), 
            validators = [Email()],
            )
    created_time = DateField(
            label = _('Created time'),
            )
    role_id = RadioField(
            label = "Role",
            validators = [AnyOf([str(val) for val in USER_ROLE.keys()])],
            choices = [(str(val), label) for val, label in USER_ROLE.items()],
            )
    status_id = RadioField(
            label = "Status",
            validators = [AnyOf([str(val) for val in USER_STATUS.keys()])],
            choices = [(str(val), label) for val, label in USER_STATUS.items()],
            )
    real_name = TextField(
            label = _('Real name'),
            validators = [
                Length(REALNAME_LEN_MIN, REALNAME_LEN_MAX),
                ]
            )
    age = IntegerField(
            label = _('Age'), 
            validators = [NumberRange(AGE_MIN, AGE_MAX)],
            )
    phone = TelField(
            label = _('Phone'), 
            )
    url = URLField(
            label = _('URL'), 
            validators = [URL()],
            )
    deposit = DecimalField(
            label = _('Deposit'), 
            validators = [NumberRange(DEPOSIT_MIN, DEPOSIT_MAX)],
            )
    location = TextField(
            label = _('Location'), 
            validators = [Length(max=50)]
            )
    bio = TextAreaField(
            label = _('Bio'), 
            validators = [Length(max=1024)]
            )
    submit = SubmitField(_('Save'))
Example #18
0
class StockOutForm(Form):
    sku = QuerySelectField(u'商品',query_factory=skus,get_label='name')
    store_id = SelectField(u"仓库", [AnyOf([str(val) for val in STORES.keys()])],choices=[(str(val), label) for val, label in STORES.items()])
    c = SelectField(u"出库类型", [AnyOf([str(val) for val in STOCK_OUT_CATEGORIES_IDs])],choices=[(str(val), STOCK_OUT_CATEGORIES[val]) for val in STOCK_OUT_CATEGORIES_IDs])
    code = TextField(u'出库凭证')
    purchase_price = FloatField(u'进货价',default=0.0)
    quantity = IntegerField(u'出库数量',[validate_gte_0])
    order_id = TextField(u'关联订单号')
    remark = TextAreaField(u'备注')
Example #19
0
class CompletedMatchPlayerForm(Form):
    user_id = SelectField(u'Player',
                          coerce=int,
                          choices=[],
                          validators=[Required()])
    kills = IntegerField(u'Kills', default=0, validators=[NumberRange(min=0)])
    deaths = IntegerField(u'Deaths',
                          default=0,
                          validators=[NumberRange(min=0)])
    off_objs = IntegerField(u'Offensive Objectives',
                            default=0,
                            validators=[NumberRange(min=0)])
    def_objs = IntegerField(u'Defensive Objectives',
                            default=0,
                            validators=[NumberRange(min=0)])
    score = IntegerField(u'Score', default=0)

    def __init__(self, *args, **kwargs):
        kwargs.setdefault('csrf_enabled', False)
        super(CompletedMatchPlayerForm, self).__init__(*args, **kwargs)
Example #20
0
    class SettingsForm(Form, wtforms.ext.i18n.form.Form):
        LANGUAGES = [get_locale().language]

        language = SelectField(
            lazy_gettext('settings.language'),
            default=current_user.config.language,
            choices=[('auto', lazy_gettext('settings.language.autodetect')),
                     ('en', u'English'), ('fr', u'Français')])
        episodesPerShow = IntegerField(
            lazy_gettext('settings.episodesPerShow'),
            default=current_user.config.episodesPerShow,
            validators=[validators.NumberRange(min=1)])
Example #21
0
class ProgramForm(Form):
    carga_aireada = IntegerField(u'Carga Aireada', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(1, 9999,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
    aireacion = IntegerField(u'Aireación', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(1, 9999,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
    sedimentacion = IntegerField(u'Sedimentación', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(1, 9999,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
    descarga = IntegerField(u'Descarga', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(1, 9999,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
Example #22
0
class ForumBotForm(Form):
    type = SelectField(u'Forum Type', coerce=int, choices=ForumBot.TypeChoices)
    url = StrippedTextField(u'Forums URL', \
            validators=[Length(min=0,max=255), Required()])
    forum_id = IntegerField(u'Forum ID', default=1,
            validators=[NumberRange(min=0), Required()])
    user_name = StrippedTextField(u'User Name', \
            validators=[Length(min=0,max=200), Required()])
    password = StrippedTextField(u'Password', \
            validators=[Length(min=0,max=200), Required()])

    game_id = SelectField(u'Post when...', coerce=int, validators=[Required()])
Example #23
0
class ProjectForm(Form):
  id = IntegerField('id')
  name = TextField('name', [validators.Required()])
  description = TextField('description')

  def __init__(self, *args, **kwargs):
    Form.__init__(self, *args, **kwargs)
    self.project = None

  def validate(self):
    rs = Form.validate(self)

    return rs
Example #24
0
class StockInForm(Form):
    sku = QuerySelectField(u'商品',query_factory=skus,get_label='name')
    store_id = SelectField(u"仓库", [AnyOf([str(val) for val in STORES.keys()])],choices=[(str(val), label) for val, label in STORES.items()])
    c = SelectField(u"入库方式", [AnyOf([str(val) for val in STOCK_IN_CATEGORIES_IDs])],choices=[(str(val), STOCK_IN_CATEGORIES[val]) for val in STOCK_IN_CATEGORIES_IDs])
    shelf_number = TextField(u'货架号')
    code = TextField(u'入库凭证')
    made_in = TextField(u'产地')
    purchase_price = FloatField(u'进货价',default=0.0)
    mfg_date = DateField(u'生产日期',[Optional()])
    exp_date = DateField(u'有效期至',[Optional()])
    quantity = IntegerField(u'入库数量',[validate_gte_0])
    order_id = TextField(u'关联订单号')
    remark = TextAreaField(u'备注')
Example #25
0
def Profile(user):
    class profile(Form):
        pass

    if user.heightInch is None:  #metric
        defaultSystem = "Metric"
        defaultHeight = [int(user.heightFeet), None, None, None]
        defaultWeight = [int(user.weight), None]

    else:
        defaultSystem = "US"
        defaultHeight = [
            None, None, int(user.heightFeet),
            int(user.heightInch)
        ]
        defaultWeight = [None, int(user.weight)]

    profile.age = IntegerField('age',
                               validators=[Required()],
                               default=int(user.age))
    profile.gender = RadioField('gender',
                                validators=[Required()],
                                choices=[("Males", "Male"),
                                         ("Females", "Female")],
                                default=user.gender)
    profile.conditions = SelectField('condition',
                                     choices=[("None", "None"),
                                              ("Pregnancy", "Pregnancy"),
                                              ("Lactation", "Lactation")],
                                     validators=[Required()],
                                     default=user.conditions)

    profile.unitSystem = RadioField('gender',
                                    validators=[Required()],
                                    choices=[("US", "US"),
                                             ("Metric", "Metric")],
                                    default=defaultSystem)
    profile.weight = IntegerField('weight(lb)', [validators.Optional()],
                                  default=defaultWeight[1])
    profile.weightKg = IntegerField('weight(kg)', [validators.Optional()],
                                    default=defaultWeight[0])
    profile.heightFeet = IntegerField('height(ft)', [validators.Optional()],
                                      default=defaultHeight[2])
    profile.heightInch = IntegerField('height(in)', [validators.Optional()],
                                      default=defaultHeight[3])
    profile.heightCm = IntegerField('height(cm)', [validators.Optional()],
                                    default=defaultHeight[0])
    profile.activity = SelectField('activity',
                                   coerce=float,
                                   choices=[(1.2, "Sedentary"),
                                            (1.375, "Lightly Active"),
                                            (1.55, "Moderately Active"),
                                            (1.725, "Very active"),
                                            (1.9, "Extremely Active")],
                                   validators=[Required()],
                                   default=user.activity)
    profile.saveChange = SubmitField("Save Changes")
    form = profile()
    return form
Example #26
0
class SshConfigForm(Form):

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    name = TextField(u'Name', description=u'Ssh Config name. Unique',
                     validators=[Required(message=u'Name is required'),
                                 Regexp(u'^[a-zA-Z0-9\_\-\.\ ]{1,20}$', message=u'Incorrect name format'),
                                 Unique(SshConfig, SshConfig.name,
                                        message=u'The current name is already in use')])
    desc = TextField(u'Description', validators=[Required(message=u'Description is required')])
    port = IntegerField(u'Port', default=22,
                        validators=[Required(message=u'Port is required')])
    username = TextField(u'Username', default=u'root',
                         validators=[Required(message=u'Username is required')])
    password = TextField(u'Password',
                         validators=[Required(message=u'Password is required')])
    private_key = TextField(u'Private Key:',
                            description=u'Private filename in <code>PRIVATE_KEY_PATH</code>')
    groups = QuerySelectMultipleField(u'Group', description=u'Multiple Choice',
                                      query_factory=Group.query.all, get_label='desc',
                                      validators=[Required(message=u'Group is required')])
    submit = SubmitField(u'Submit', id='submit')
Example #27
0
class ParametersForm(Form):
    oxigen_min = DecimalField(u'Oxígeno Mínimo', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(0.01, 99.99,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
    oxigen_max = DecimalField(u'Oxígeno Máximo', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(0.01, 99.99,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
    cloudiness_max = IntegerField(u'Turbiedad Máxima', [
        validators.Required("Campo obligatorio"),
        validators.NumberRange(1, 9999,
                               "El valor debe estar entre %(min)s y %(max)s"),
    ])
Example #28
0
class GroupForm(Form):

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    name = TextField(u'Name',
                     description=u'Unique',
                     validators=[
                         Required(message=u'Name is required'),
                         Unique(Group,
                                Group.name,
                                message=u'The current name is already in use')
                     ])
    desc = TextField(u'Description',
                     validators=[Required(message=u'Description is required')])

    submit = SubmitField(u'Submit', id='submit')
Example #29
0
class SeasonCycleForm(Form):
	leaguename = TextField('League Name', [validators.Required()],
							description=u'League Name')
	cyclename = TextField('Cycle Name', [validators.Required(), 
						   validators.length(min=6, max=25)],
						   description=u'Season Cycle Description')
	num_of_teams = IntegerField('Number Of Teams', [validators.Required()],
								description=u'Max # Teams')
	home_region = TextField('League Name', [validators.Required()],
							description=u'Home Region')
	fee_resident = FloatField('Resident Fee', [validators.Required()],
							  description=u'Resident Fee')
	fee_nonresident = FloatField('Resident Fee', [validators.Optional()],
								  description=u'Nonresident Fee (Optional)') 
	reg_start = DateField('Registration Starts', [validators.Required(message=(u'start date: mm/dd/yyyy'))], 
						   format= '%m/%d/%Y', description=u'Registration Starts (mm/dd/yyyy)')
	reg_end = DateField('Registration Ends', [validators.Required(message= (u'end date: mm/dd/yyyy'))], 
						 format= '%m/%d/%Y', description=u'Registration Ends (mm/dd/yyyy)')
Example #30
0
class IDCForm(Form):

    next_page = HiddenField()
    id = IntegerField(widget=HiddenInput())

    name = TextField(u'Name',
                     validators=[
                         Required(message=u'Name is required'),
                         Regexp(u'^[a-zA-Z0-9\_\-\.]{3,20}$',
                                message=u'Incorrect name format')
                     ])
    desc = TextField(u'Description',
                     validators=[Required(message=u'Description is required')])
    operators = TextField(
        u'Operators', validators=[Required(message=u'Operators is required')])
    address = TextField(u'Address',
                        validators=[Required(message=u'Address is required')])

    submit = SubmitField(u'Submit', id='submit')
Example #31
0
 def process_formdata(self, valuelist):
     if valuelist and not valuelist[0]:
         valuelist = None
     return IntegerField.process_formdata(self, valuelist)