コード例 #1
0
ファイル: forms.py プロジェクト: GoOutSafeS3/GoOutSafe
class OperatorForm(FlaskForm):
    """
    Form to insert a operator's data (profile)
    """
    email = EmailField('Email', validators=[DataRequired(), Email()])
    firstname = f.StringField('Firstname', validators=[DataRequired()])
    lastname = f.StringField('Lastname', validators=[DataRequired()])
    password = f.PasswordField('Password', validators=[DataRequired()])
    password_repeat = f.PasswordField('Repeat Password',
                                      validators=[DataRequired()])
    telephone = f.StringField('Telephone', validators=[DataRequired()])
    dateofbirth = f.DateField('Date Of Birth', format='%d/%m/%Y')

    restaurant_name = f.StringField('Restaurant Name',
                                    validators=[DataRequired()])
    restaurant_phone = f.StringField('Restaurant Phone',
                                     validators=[DataRequired()])
    restaurant_latitude = f.FloatField('Restaurant latitude',
                                       validators=[InputRequired()])
    restaurant_longitude = f.FloatField('Restaurant Longitude',
                                        validators=[InputRequired()])

    display = [
        'email', 'firstname', 'lastname', 'password', 'password_repeat',
        'telephone', 'dateofbirth', 'restaurant_name', 'restaurant_phone',
        'restaurant_latitude', 'restaurant_longitude'
    ]
コード例 #2
0
ファイル: lot.py プロジェクト: alkagan/Senior_Design
class UpdateLot(flask_wtf.FlaskForm):
    defaultPermissions = wtforms.StringField('Default Permissions',
                                             [wtforms.validators.required()])
    currentPermissions = wtforms.StringField('Current Permissions',
                                             [wtforms.validators.required()])
    latitude = wtforms.FloatField('Lot Lat', default=1.0)
    longitude = wtforms.FloatField('Lot Long', default=1.0)
コード例 #3
0
class ForecastingForm(FlaskForm, wtforms.Form):
    suhu_minimum = wtforms.FloatField('Suhu Minimum',
                                      validators=[DataRequired()])
    suhu_maksimum = wtforms.FloatField('Suhu Maksimum',
                                       validators=[DataRequired()])
    suhu_rata_rata = wtforms.FloatField('Suhu rata-rata',
                                        validators=[DataRequired()])
    kelembapan_rata2x = wtforms.FloatField('Kelembapan rata-rata',
                                           validators=[DataRequired()])
    curah_hujan = wtforms.FloatField('Curah hujan',
                                     validators=[DataRequired()])
    lama_penyinaran = wtforms.FloatField('Lama Penyinaran',
                                         validators=[DataRequired()])
    kecepatan_angin_rata2x = wtforms.FloatField('Kecepatan angin rata-rata',
                                                validators=[DataRequired()])
    arah_angin_terbanyak = wtforms.FloatField('Arah angin terbanyak',
                                              validators=[DataRequired()])
    kecepatan_angin_terbesar = wtforms.FloatField('Kecepatan angin terbesar',
                                                  validators=[DataRequired()])
    arah_angin_saat_max = wtforms.FloatField(
        'Arah angin saat kecepatan maksimum', validators=[DataRequired()])

    # submit = SubmitField('Predict')

    def save(self, data):
        self.populate_obj(data)
コード例 #4
0
class RestaurantForm(FlaskForm):
    name = f.StringField('Name', validators=[DataRequired()])
    lat = f.FloatField('Latitude', validators=[DataRequired()])
    lon = f.FloatField('Longitude', validators=[DataRequired()])
    phone = f.StringField('Phone', validators=[DataRequired()])

    # Note: the capacity is automatically derived from tables settings

    cuisine_type = f.SelectMultipleField(
        'Cuisine types', 
        choices = Restaurant.CUISINE_TYPES.choices(),
        coerce = Restaurant.CUISINE_TYPES.coerce, 
        validators=[DataRequired()]
    )
    prec_measures = f.TextAreaField('Precautionary measures',validators=[DataRequired()])
    avg_time_of_stay = f.IntegerField('Average time of stay (in minutes)', validators=[DataRequired(), NumberRange(min=15)])

    workingdays = f.FieldList(f.FormField(WorkingDayForm), min_entries=1, max_entries=7)
    tables = f.FieldList(f.FormField(TableForm), min_entries=1, max_entries=100)
    dishes = f.FieldList(f.FormField(DishForm), min_entries=1, max_entries=100)

    display = ['name', 'lat', 'lon', 'phone', 'cuisine_type', 'prec_measures', 'avg_time_of_stay']
    
    def validate_workingdays(form, field):
        days_already_added = []
        for wd in field.data:
            if wd['day'] in days_already_added:
                raise ValidationError("There cannot be two working days with the same day")
            else:
                days_already_added.append(wd['day'])
コード例 #5
0
class DiscountForm(FlaskForm):
    code = form.StringField(
        'Code',
        validators=[validator.DataRequired(),
                    validator.Length(max=50)])
    amount = form.FloatField(
        'Amount',
        validators=[validator.Optional(),
                    validator.NumberRange(min=1)])
    percentage = form.FloatField('Percentage',
                                 validators=[
                                     validator.Optional(),
                                     validator.NumberRange(min=1, max=100)
                                 ])
    is_active = form.BooleanField('Is Active', default=True)

    def validate(self):
        if not super(DiscountForm, self).validate():
            return False
        if self.amount.data and self.percentage.data:
            flash('Both amount and percentage cannot be set at the same time',
                  'error')
            return False
        if not self.amount.data and not self.percentage.data:
            flash('Please provide either an amount or a percentage', 'error')
            return False
        return True
コード例 #6
0
class BeerForm(wtforms.Form):
    name = wtforms.StringField(
        'name',
        [wtforms.validators.Length(max=64),
         wtforms.validators.DataRequired()])
    description = wtforms.StringField('description', [
        wtforms.validators.Length(max=1024),
        wtforms.validators.DataRequired()
    ])
    brewedBy = wtforms.StringField(
        'brewedBy',
        [wtforms.validators.Length(max=64),
         wtforms.validators.DataRequired()])
    style = wtforms.StringField(
        'style',
        [wtforms.validators.Length(max=64),
         wtforms.validators.DataRequired()])
    abv = wtforms.FloatField('abv',
                             [wtforms.validators.NumberRange(min=0, max=100)])
    rating = wtforms.FloatField(
        'rating', [wtforms.validators.NumberRange(min=0, max=100)])
    ibu = wtforms.FloatField('ibu',
                             [wtforms.validators.NumberRange(min=0, max=300)])
    srm = wtforms.FloatField('srm',
                             [wtforms.validators.NumberRange(min=0, max=100)])
    costPerPint = wtforms.FloatField('costPerPint')
コード例 #7
0
ファイル: forms.py プロジェクト: xwa9860/web4sciapps
class ComputeForm(wtf.Form):
    A = wtf.FloatField(label='\( A \)', default=1.0,
        validators=[wtf.validators.InputRequired()])
    b = wtf.FloatField(label='\( b \)', default=0.0,
        validators=[wtf.validators.InputRequired()])
    w = wtf.FloatField(label='\( w \)', default=pi,
        validators=[wtf.validators.InputRequired()])
    T = wtf.FloatField(label='\( T \)', default=18,
        validators=[wtf.validators.InputRequired()])
    resolution = wtf.IntegerField(label='resolution', default=500,
        validators=[wtf.validators.InputRequired()])
コード例 #8
0
ファイル: party_form.py プロジェクト: SuyogSoti/PartyRoom
class PartyRoomCreateForm(FlaskForm):
    room_creator = None
    room_name = TextField('What is the name of the Room?',
                          validators=[Required(), Length(max=2047)])
    room_password = PasswordField(
        "Please type a room password",
        validators=[Required(), Length(max=2047, min=6)])
    danceability = wtforms.FloatField("How danceable should the songs be between 0 and 1", validators=[NumberRange(min=0, max=1)])
    loudness = wtforms.FloatField("How loud should the songs be between 0 and 1", validators=[NumberRange(min=0, max=1)])
    energy = wtforms.FloatField("How energetic should the songs be between 0 and 1", validators=[NumberRange(min=0, max=1)])
    speechiness = wtforms.FloatField("How wordy should the songs be between 0 and 1", validators=[NumberRange(min=0, max=1)])
    submit = SubmitField('Submit - Requires Spotify Login')
class RestaurantProfileEditForm(FlaskForm):
    name = f.StringField('Name', validators=[DataRequired()])
    lat = f.FloatField('Latitude', validators=[DataRequired()])
    lon = f.FloatField('Longitude', validators=[DataRequired()])
    phone = f.IntegerField('Phone number',
                           validators=[DataRequired()],
                           render_kw={
                               "minlength": "9",
                               "maxlength": "10"
                           })
    extra_info = f.TextAreaField('Extra info')
    display = ['name', 'lat', 'lon', 'phone', 'extra_info']
コード例 #10
0
class TrainingObjectiveVisualizerForm(FlaskForm):
    start_date = f.DateField('Start Date')
    end_date = f.DateField('End Date')
    km_to_run = f.FloatField('Km to Run')
    traveled_kilometers = f.FloatField('Traveled Km')
    status = f.StringField('Status')
    description = f.StringField('Description')

    display = [
        'start_date', 'end_date', 'km_to_run', 'traveled_kilometers', 'status',
        'description'
    ]
コード例 #11
0
class UserForm(FlaskForm):
    email = f.StringField('email', validators=[DataRequired()])
    firstname = f.StringField('firstname')
    lastname = f.StringField('lastname')
    password = f.PasswordField('password')
    age = f.IntegerField('age')
    weight = f.FloatField('weight')
    max_hr = f.IntegerField('max_hr')
    rest_hr = f.IntegerField('rest_hr')
    vo2max = f.FloatField('vo2max')

    display = ['email', 'firstname', 'lastname', 'password',
               'age', 'weight', 'max_hr', 'rest_hr', 'vo2max']
コード例 #12
0
ファイル: forms.py プロジェクト: waooog/mutate_cpp
class CreateProjectForm(FlaskForm):
    name = wtforms.StringField('name', validators=[DataRequired()])
    workdir = wtforms.StringField('workdir', validators=[DataRequired()])
    build_command = wtforms.StringField('build_command',
                                        validators=[DataRequired()])
    quickcheck_command = wtforms.StringField('quickcheck_command',
                                             validators=[Optional()])
    quickcheck_timeout = wtforms.FloatField('quickcheck_timeout',
                                            validators=[Optional()])
    test_command = wtforms.StringField('test_command',
                                       validators=[DataRequired()])
    test_timeout = wtforms.FloatField('test_timeout', validators=[Optional()])
    clean_command = wtforms.StringField('clean_command',
                                        validators=[Optional()])
コード例 #13
0
class CreateRestaurantForm(FlaskForm):
    name = f.StringField("Name", validators=[DataRequired()])
    lat = f.FloatField(
        "Latitude",
        validators=[
            DataRequired(),
            NumberRange(-90, 90, "Latitude must be between -90 and 90"),
        ],
    )
    lon = f.FloatField(
        "Longitude",
        validators=[
            DataRequired(),
            NumberRange(-180, 180, "Longitude must be between -180 and 180"),
        ],
    )
    phone = f.IntegerField("Phone", validators=[DataRequired()])
    time_of_stay = f.RadioField(
        "Time of stay",
        choices=[("30", "30 minutes"), ("90", "1:30 hour"), ("180", "3 hours")],
        validators=[DataRequired()],
    )
    opening_hours = f.IntegerField(
        "Opening hours",
        validators=[DataRequired(), NumberRange(0, 24, "Not a valid hour")],
    )
    closing_hours = f.IntegerField(
        "Closing hours",
        validators=[DataRequired(), NumberRange(0, 24, "Not a valid hour")],
    )
    cuisine_type = f.SelectField(
        "Cuisine type", choices=CuisineType.choices(), validators=[DataRequired()]
    )
    prec_measures = MultiCheckboxField(
        "Precautions",
        get_label="name",
        query_factory=precautions_choices,
    )
    display = [
        "name",
        "lat",
        "lon",
        "phone",
        "opening_hours",
        "closing_hours",
        "cuisine_type",
        "time_of_stay",
        "prec_measures",
    ]
コード例 #14
0
ファイル: transfer_reports.py プロジェクト: spficklin/BDSS
class TransferReportForm(wtforms.Form):
    """
    Form for reporting transfer times.
    """

    is_success = wtforms.BooleanField(false_values=('false', 'False', ''),
                                      label="Successful Transfer")

    url = wtforms.StringField(label="URL",
                              validators=[wtforms.validators.InputRequired()])

    destination = wtforms.fields.SelectField(
        label="Destination", validators=[wtforms.validators.Optional()])

    file_size_bytes = wtforms.IntegerField(
        label="File Size (bytes)",
        validators=[wtforms.validators.InputRequired()])

    transfer_duration_seconds = wtforms.FloatField(
        label="Transfer Duration (seconds)",
        validators=[wtforms.validators.InputRequired()])

    file_checksum = wtforms.StringField(
        label="MD5 Checksum", validators=[wtforms.validators.InputRequired()])

    def validate_file_checksum(form, field):
        if form.file_size_bytes.data > 0:
            if not field.data:
                raise wtforms.ValidationError("This field is required")
            if not re.match(r"[0-9A-Fa-f]{32}", field.data):
                raise wtforms.ValidationError("Invalid checksum")

    mechanism_output = wtforms.fields.TextAreaField(
        label="Mechanism Output", validators=[wtforms.validators.Optional()])
コード例 #15
0
class TrainingObjectiveSetterForm(FlaskForm):

    dateNotValid = 'Not a valid date'
    endNotValid = 'Cannot be before Start Date'
    kmNotValid = 'You need to run at least a meter'

    def kmFilter(value):
        if value is not None:
            return float('%.3f' % float(value))
        else:
            return value

    start_date = f.DateField(
        'Start Date',
        validators=[DataRequired(message=dateNotValid),
                    fc.NotLessThenToday()],
        widget=f.widgets.Input(input_type='date'))
    end_date = f.DateField('End Date',
                           validators=[
                               DataRequired(message=dateNotValid),
                               fc.NotLessThan('start_date',
                                              message=endNotValid),
                               fc.NotLessThenToday()
                           ],
                           widget=f.widgets.Input(input_type='date'))
    km_to_run = f.FloatField('Km to run',
                             validators=[
                                 DataRequired(kmNotValid),
                                 NumberRange(min=0.001, message=kmNotValid)
                             ],
                             widget=fc.FloatInput(step='any', min_='0'),
                             filters=[kmFilter])

    display = ['start_date', 'end_date', 'km_to_run']
コード例 #16
0
class ObjectiveForm(FlaskForm):
    name = f.StringField(
        'Name', validators=[DataRequired("Insert the objective name")])
    start_date = f.DateField(
        'Start date',
        format='%Y-%m-%d',
        validators=[DataRequired("Insert when to start the objective")])
    end_date = f.DateField(
        'End Date',
        format='%Y-%m-%d',
        validators=[DataRequired("Insert when to end the objective")])
    target_distance = f.FloatField(
        'Target Distance',
        validators=[DataRequired("Insert the target distance")])

    display = ['name', 'start_date', 'end_date', 'target_distance']

    def validate(self):
        if not FlaskForm.validate(self):
            return False
        result = True

        # Check start_date < end_date
        if self.start_date.data > self.end_date.data:
            result = False

        return result
コード例 #17
0
class DonationForm(FlaskForm):
    first_name = form.StringField(
        'First Name',
        validators=[validator.DataRequired(),
                    validator.Length(max=100)],
        render_kw={"placeholder": "Your First Name"})
    last_name = form.StringField(
        'Last Name',
        validators=[validator.DataRequired(),
                    validator.Length(max=100)],
        render_kw={"placeholder": "Your Last Name"})
    phone_number = form.StringField(
        'Phone Number',
        validators=[validator.Length(max=50)],
        render_kw={"placeholder": "Your Phone Number"})
    email = form.StringField('Email Address',
                             render_kw={"placeholder": "Your Email Address"},
                             validators=[
                                 validator.DataRequired(),
                                 validator.Email(),
                                 validator.Length(max=50)
                             ])
    amount = form.FloatField(
        'Enter Amount',
        validators=[validator.DataRequired(),
                    validator.NumberRange(min=0)],
        render_kw={"placeholder": "Enter an Amount"})
    message = form.TextAreaField(
        'Message',
        validators=[validator.Optional()],
        render_kw={"placeholder": "Send a message to the newly-weds"})
コード例 #18
0
class FanForm(wtf.Form):

    Radar = wtf.SelectField(label='Radar',
                            validators=[wtf.validators.InputRequired()],
                            choices=[('Rankin Inlet','rkn'),
                                     ('Clyde River', 'cly'),
                                     ('Saskatoon','sas'),
                                     ('Prince George','pgr'),
                                     ('Inuvet','inv')])

    duration_time = wtf.FloatField(label='duration time (hr)',
                                   default=24,
                                   description="seconds",
                                   validators=[wtf.validators.InputRequired()])

    date = wtf.DateField(label='Date',
                         format="%Y%m%d",
                         description="YYYYMMDD",
                         validators=[wtf.validators.InputRequired()])

    start_time = wtf.StringField(label='Start time',
                                 description="HH:MM",
                                 validators=[wtf.validators.InputRequired()])

    ground_scatter = wtf.BooleanField(default=True,
                                      label="Ground Scatter")
    plot = wtf.SubmitField(label='Plot',validators=[wtf.validators.InputRequired()])
コード例 #19
0
class ProfileForm(UserForm):
    email = EmailField('Email', validators=[DataRequired(), Email()])
    firstname = f.StringField('Firstname', validators=[DataRequired()])
    lastname = f.StringField('Lastname', validators=[DataRequired()])
    password = f.PasswordField('Password', validators=[])
    age = f.IntegerField('Age', validators=[DataRequired()])
    weight = f.FloatField('Weight', validators=[DataRequired()])
    max_hr = f.IntegerField('Max Heartrate', validators=[DataRequired()])
    rest_hr = f.IntegerField('Rest Heartrate', validators=[DataRequired()])
    vo2max = f.FloatField('VO2 Max', validators=[DataRequired()])
    periodicity = f.SelectField('Report Periodicity')

    display = [
        'email', 'firstname', 'lastname', 'password', 'age', 'weight',
        'max_hr', 'rest_hr', 'vo2max', 'periodicity'
    ]
コード例 #20
0
class OrderForm(FlaskForm):
    invoice_type = wtf.SelectField(
        'Tipo de Nota',
        coerce=str,
        choices=(('Não informado', 'Não informado'), ('Nota Fiscal',
                                                      'Nota Fiscal'),
                 ('Nota de Fornecimento (FIOCRUZ)',
                  'Nota de Fornecimento (FIOCRUZ)'),
                 ('Nota de Fornecimento (Ministério da Saúde)',
                  'Nota de Fornecimento (Ministério da Saúde)'), ('Outros',
                                                                  'Outros')),
        default='Não informado',
        validators=[Optional()])
    invoice = wtf.StringField('Nota', validators=[Optional()])
    invoice_value = wtf.FloatField('Valor total',
                                   render_kw={'placeholder': 'R$ 123.40'},
                                   validators=[Optional()],
                                   widget=widgets.NumberInput(
                                       step='0.01',
                                       min='0.00',
                                       max='9999999999.99'))
    financier = wtf.StringField('Financiador', validators=[Optional()])
    notes = wtf.StringField('Observações', validators=[Optional()])
    submit = wtf.SubmitField('Inserir no estoque')
    cancel = wtf.SubmitField('Limpar o carrinho')
コード例 #21
0
class RegistrationForm(wtforms.Form):
    delta = wtforms.FloatField('Delta', default="0.3")
    activewheels1 = wtforms.BooleanField('Active Wheels 1', default=True)
    activewheels2 = wtforms.BooleanField('Active Wheels 2')
    activewheels3 = wtforms.BooleanField('Active Wheels 3')
    activewheels4 = wtforms.BooleanField('Active Wheels 4')
    activewheels5 = wtforms.BooleanField('Active Wheels 5')
    activewheels6 = wtforms.BooleanField('Active Wheels 6')
    valvelocation1 = wtforms.StringField(
        'Valve Location 1', [wtforms.validators.Length(min=0, max=3)],
        default="25")
    valvelocation2 = wtforms.StringField(
        'Valve Location 2', [wtforms.validators.Length(min=0, max=3)],
        default="33")
    valvelocation3 = wtforms.StringField(
        'Valve Location 3', [wtforms.validators.Length(min=0, max=3)],
        default="23")
    valvelocation4 = wtforms.StringField(
        'Valve Location 4', [wtforms.validators.Length(min=0, max=3)],
        default="24")
    valvelocation5 = wtforms.StringField(
        'Valve Location 5', [wtforms.validators.Length(min=0, max=3)],
        default="13")
    valvelocation6 = wtforms.StringField(
        'Valve Out Location', [wtforms.validators.Length(min=0, max=3)],
        default="24")
    pumplocation1 = wtforms.StringField(
        'Pump In Location 1', [wtforms.validators.Length(min=0, max=3)],
        default="16")
    pumplocation2 = wtforms.StringField(
        'Pump Out Location 2', [wtforms.validators.Length(min=0, max=3)],
        default="12")
コード例 #22
0
class ChoiceEditorForm(EditorForm):
    value = wtf.StringField(_l('Value'),
                            validators=[wtf.validators.DataRequired()])
    points = wtf.FloatField(_l('Points'),
                            default=0,
                            validators=[wtf.validators.Optional()])
    max_levenshtein_distance = wtf.IntegerField(
        _l('Flexibility (1-5)'),
        default=3,
        validators=[wtf.validators.NumberRange(min=1, max=5)])

    submit = wtf.SubmitField(_l('Save'),
                             render_kw={'class_': 'btn btn-success'})
    delete = wtf.SubmitField(_l('Remove'),
                             render_kw={'class_': 'btn btn-danger'})

    def __init__(self,
                 choice: model.Choice = None,
                 question: model.Question = None,
                 *args,
                 **kwargs):
        if choice is None:
            if question is None or question.id is None:
                raise ValueError('Question must be provided for new choice!')
            else:
                choice = model.Choice(question_id=question.id)
        super().__init__(choice, *args, **kwargs)
コード例 #23
0
ファイル: forms.py プロジェクト: runick67/perx_test
class TaskForm(wtforms.Form):

    count = wtforms.IntegerField('Количество элементов',
                                 description='Количество элементов')
    delta = wtforms.FloatField('Дельта между элементами', description='Дельта')
    start = wtforms.FloatField('Стартовое значение',
                               description='Стартовое значение')
    interval = wtforms.FloatField('Интервал в секундах между итерациями',
                                  description='Интервал')

    def validate_count(self, field):
        if not field.errors and field.data < 2:
            raise wtforms.ValidationError('Неверное число элементов')

    def validate_interval(self, field):
        if not field.errors and field.data < 0:
            raise wtforms.ValidationError('Интервал не может быть меньше нуля')
コード例 #24
0
class DishForm(Form):
    """Subform.

    CSRF is disabled for this subform (using `Form` as parent class) because
    it is never used by itself.
    """
    dish_name = f.StringField('Name', validators=[DataRequired()])
    price = f.FloatField('Price', validators=[DataRequired()])
    ingredients = f.StringField('Ingredients', validators=[DataRequired()])
コード例 #25
0
ファイル: float.py プロジェクト: vagcosta/GodMode2
class FloatWidget(BaseWidget):
    field = wtforms.FloatField()

    def render_list(self, item):
        value = getattr(item, self.name, None)
        try:
            return round(value, 3)
        except ValueError:
            return value
コード例 #26
0
class UserForm(FlaskForm):
    email = EmailField(
        'Email', validators=[DataRequired(),
                             Email(),
                             UniqueMailValidator()])
    firstname = f.StringField('Firstname', validators=[DataRequired()])
    lastname = f.StringField('Lastname', validators=[DataRequired()])
    password = f.PasswordField('Password', validators=[DataRequired()])
    age = f.IntegerField('Age', validators=[DataRequired()])
    weight = f.FloatField('Weight', validators=[DataRequired()])
    max_hr = f.IntegerField('Max Heartrate', validators=[DataRequired()])
    rest_hr = f.IntegerField('Rest Heartrate', validators=[DataRequired()])
    vo2max = f.FloatField('VO2 Max', validators=[DataRequired()])

    display = [
        'email', 'firstname', 'lastname', 'password', 'age', 'weight',
        'max_hr', 'rest_hr', 'vo2max'
    ]
class OperatorForm(FlaskForm):
    l1 = f.Label('Owner infos', 'Owner infos')
    email = f.StringField('e-mail',
                          validators=[
                              DataRequired(),
                              Email(message="Please enter a valid email")
                          ])
    firstname = f.StringField('Name', validators=[DataRequired()])
    lastname = f.StringField('Last name', validators=[DataRequired()])
    password = f.PasswordField('Password', validators=[DataRequired(), \
        Length(min=4, max=12, message="Password must be in [4,12] characters"), EqualTo('password_confirm', message='Passwords must match')])
    password_confirm = f.PasswordField('Confirm password',
                                       validators=[DataRequired()])
    dateofbirth = DateField('Date of birth',
                            format='%Y-%m-%d',
                            validators=[DataRequired()])
    h1 = f.HiddenField()
    l2 = f.Label('', 'Restaurant info')
    name = f.StringField('Name', validators=[DataRequired()])
    lat = f.FloatField('Latitude',
                       validators=[
                           DataRequired(),
                           NumberRange(min=-90,
                                       max=90,
                                       message="Latitude is in [-90, 90]")
                       ])
    lon = f.FloatField('Longitude',
                       validators=[
                           DataRequired(),
                           NumberRange(min=-180,
                                       max=180,
                                       message="Longitude is in [-180, 180]")
                       ])
    phone = f.IntegerField('Phone number',
                           validators=[DataRequired()],
                           render_kw={
                               "minlength": "9",
                               "maxlength": "10"
                           })
    extra_info = f.TextAreaField('Extra infos [optional]')
    display = [
        'l1', 'email', 'firstname', 'lastname', 'password', 'password_confirm',
        'dateofbirth', 'l2', 'name', 'lat', 'lon', 'phone', 'extra_info'
    ]
コード例 #28
0
ファイル: form.py プロジェクト: raiizoor/Web-delivery
class ItemsForm(FlaskForm):
    name = wtf.StringField("Nome", [wtf.validators.DataRequired()])
    image = wtf.FileField("Image", [wtf.validators.DataRequired()])
    price = wtf.FloatField("Preço", [wtf.validators.DataRequired()])
    quantity = wtf.IntegerField("Quantidade", [wtf.validators.DataRequired()])
    description = wtf.TextAreaField("Descrição",
                                    [wtf.validators.DataRequired()])
    store_id = QuerySelectField('ID da loja',
                                query_factory=lambda: Store.query.all())
    available = wtf.BooleanField("Disponivel", default=True)
コード例 #29
0
class ConvectionForm(wtf.Form):
    integration_time = wtf.FloatField(label='integration time (s)',
                                      default=120, description="seconds",
                                      validators=[wtf.validators.InputRequired()])
    date = wtf.StringField(label='Date',
                           description="YYYYMMDD",
                           validators=[wtf.validators.InputRequired()])
    start_time = wtf.StringField(label='Start time',
                                 description="HH:MM",
                                 validators=[wtf.validators.InputRequired()])
    plot = wtf.SubmitField(label='Plot',validators=[wtf.validators.InputRequired()])
コード例 #30
0
class UserForm(FlaskForm):
    email = f.StringField(
        'Email', validators=[DataRequired("Insert a valid email."),
                             Email()])
    firstname = f.StringField(
        'Firstname', validators=[DataRequired("Insert your first name.")])
    lastname = f.StringField(
        'Lastname', validators=[DataRequired("Insert your last name")])
    password = f.PasswordField(
        'Password', validators=[DataRequired("Insert a valid password")])
    age = f.IntegerField('Age', validators=[NumberRange(min=0)])
    weight = f.FloatField('Weight')
    max_hr = f.IntegerField('Max_hr')
    rest_hr = f.IntegerField('Rest_hr')
    vo2max = f.FloatField('Vo2max')

    display = [
        'email', 'firstname', 'lastname', 'password', 'age', 'weight',
        'max_hr', 'rest_hr', 'vo2max'
    ]