Example #1
0
class Deliverables_Form(Form):
    code = StringField(u'*Deliverable Code', [validators.InputRequired()],
                       render_kw={"placeholder": "e.g. D-R1.1"})
    work_package = SelectField(
        u'*Work Package',
        [validators.NoneOf(('blank'), message='Please select')])
    description = TextAreaField(u'*Description', [validators.InputRequired()],
                                render_kw={
                                    "placeholder":
                                    "e.g. Report on current state \
of knowledge regarding user needs for forecasts at \
different timescales in each sector."
                                })
    responsible_partner = SelectField(
        u'*Responsible Partner',
        [validators.NoneOf(('blank'), message='Please select')])
    month_due = IntegerField(u'Month Due', [
        validators.NumberRange(
            min=0,
            max=endMonth,
            message="Must be between 0 and " + str(endMonth))
    ])
    progress = TextAreaField(u'Progress', validators=[validators.Optional()])
    percent = IntegerField(u'*Percentage Complete', [
        validators.NumberRange(
            min=0, max=100, message="Must be between 0 and 100")
    ])
Example #2
0
class FormS1(Form):
	class Meta:
		locales = ['es_ES', 'es']

	company_name = StringField('Nombre de la empresa', [validators.Length(max=40), validators.InputRequired()])
	company_id = StringField('ID único de la empresa', [validators.Length(max=12), validators.InputRequired(), Unique(User, User.company_id, 'Esta ID ya está registrada.')])
	economic_sector = SelectField('Sector industrial principal', choices=[
		('Seleccione una opción...'),
		('Alimentos y bebidas'), 
		('Maderera'), 
		('Metalmecánica / Metalúrgica'),
		('Plásticos y derivados'),
		('Química'),
		('Muebles, objetos e iluminación'),
		('Productos e insumos textiles')], validators = [validators.NoneOf(values=[u'Seleccione una opción...'], message='Selección inválida.')])
	respondant_name = StringField('Nombre de quien responde la encuesta', [validators.Length(max=40), validators.InputRequired()])
	respondant_position = SelectField('Cargo', choices=[
		('Seleccione una opción...'),
		('Gerente General / Dueño / Director'), 
		('Gerente / Director de Operaciones'), 
		('Gerente / Director Comercial'),
		('Gerente / Director de Administración y/o Finanzas'),
		('Otro')], validators = [validators.NoneOf(values=[u'Seleccione una opción...'], message='Selección inválida.')])
	respondant_position_other = StringField('Especifique el cargo', [SkipValidationIf('respondant_position', 'respondant_position_other', 'Otro'), validators.Length(max=40), validators.InputRequired()])
	phone = TelField('Teléfono', [validators.Length(max=12), validators.InputRequired()])
	country = StringField('País', [validators.Length(max=40), validators.InputRequired()])
	country_code = HiddenField()
	admin_div_1 = StringField('Región', [validators.Length(max=40), validators.InputRequired()])
	admin_div_2 = StringField('Comuna', [validators.Length(max=40), validators.InputRequired()])
	street = StringField('Calle', [validators.Length(max=80), validators.InputRequired()])
	street_number = IntegerField('Número', [validators.InputRequired()])
Example #3
0
class GasExperiencesFormEs(Form):
    date = DateField(
        'Fecha de la experiencia',
        [validators.DataRequired(message="No es una fecha válida")],
        format='%Y-%m-%d')
    smell = RadioField(
        '¿Usted sintió el olor del vumo?',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    throat = RadioField(
        '¿Usted sintió el vumo en la garganta? Por ejemplo, ardor o prurito',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    eyes = RadioField(
        '¿Usted sintió el vumo en los ojos? Por ejemplo, ardor o prurito',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    skin = RadioField(
        '¿Usted sintió el vumo en la piel? Por ejemplo, ardor o prurito',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    tired = RadioField(
        '¿El vumo le hizo sentir inusualmente cansado/a?',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    nausea = RadioField(
        '¿El vumo le provocó náuseas?',
        [validators.InputRequired(message="No es una selección válida")],
        choices=[('Yes', 'Sí'), ('No', 'No')])
    otherObs = TextAreaField('¿Podía ver el vumo? ¿Cómo se veía?\
       Por ejemplo el color, la visibilidad. Para cualquier observación, puede escribir en este espacio'                                                                                                        ,\
       [validators.Length(min=0, max=500)])
    windDir = SelectField('¿De dónde venía el viento cuando se sintió el vumo?',\
       [validators.NoneOf(('blank'),message='Por favor seleccione')],\
       choices=[('blank','--Por favor seleccione--'),('N', 'Norte'), ('NE', 'Noreste'),\
       ('E', 'Este'), ('SE', 'Sudeste'), ('S', 'Sur'), ('SW', 'Sudoeste'),\
       ('W', 'Oeste'), ('NW', 'Noroeste'), ("Dont know", "No se sabe")])
    windSpeed = SelectField('¿Cómo era de fuerte el viento?',\
       [validators.NoneOf(('blank'),message='Por favor seleccione')],\
       choices=[('blank','--Por favor seleccione--'),('No wind', 'No había viento'), ('Slow wind', 'No muy fuerte'),\
       ('Strong wind', 'Viento fuerte'), ('Very strong wind', 'Viento muy fuerte'), ("Dont know", "No se sabe")])
    precip=SelectField('¿Había lluvia cuando se sintió el vumo?',\
       [validators.NoneOf(('blank'),message='Por favor seleccione')],\
       choices=[('blank','--Por favor seleccione--'),('No precipitation', 'No había lluvia'), ('Light rain', 'Lluvia ligera'),\
       ('Rain', 'Lluvia'),("Dont know", "No se sabe")])
    latitude = DecimalField('Latitud', [
        validators.NumberRange(
            min=10, max=16, message="Latitud fuera de límites")
    ])
    longitude = DecimalField('Longitud', [
        validators.NumberRange(
            min=-88, max=-82, message="Longitud fuera de límites")
    ])
Example #4
0
class RegistrationForm(Form):
    first_name = StringField(
        'First Name',
        validators=[
            validators.input_required(message="Please provide your first name")
        ])
    last_name = StringField(
        'Last Name',
        validators=[
            validators.input_required(message="Please provide your last name")
        ])
    email = StringField(
        'E-Mail',
        validators=[validators.Email(message='Not a valid email address')])
    public_key = StringField(
        'Username',
        validators=[
            validators.input_required(message="Please create a username"),
            validators.Length(
                min=8,
                max=50,
                message="username must be at least 8 and maximal 50 characters"
            ),
            validators.NoneOf(all_usernames(),
                              message="Username already exists")
        ])
Example #5
0
class UploadForm(Form):
    title = StringField(
        u'Title of material',
        [validators.required(),
         validators.Length(min=1, max=50)])
    description = TextAreaField(
        u'Description of material',
        [validators.optional(),
         validators.Length(max=1000)])
    type = SelectField('Select the type of material you are uploading',
                       [validators.NoneOf(('blank'), message='Please select')])
    who = SelectField(
        'Is the material for trainees (typically non-editable files, e.g. PDFs) or trainers (typically editable files, e.g. PPTs)',
        [validators.NoneOf(('blank'), message='Please select')],
        choices=[('blank', '--Please select--'), ('trainees', 'Trainees'),
                 ('trainers', 'Trainers')])
Example #6
0
 class VolunteerForm(Form):
     name = TextField(
         'Full Name', [validators.Required()],
         description=
         u"Please enter your full name, first (given) name first, family (last) name last."
     )
     email = TextField('Email Address')
     # This seems to make email a required field, so disabling validation for now - BDunnette 2013/07/28
     #email = TextField('Email Address',
     #                  [validators.Email(message='Please enter a valid email address')])
     phone = TextField('Phone #')
     street = TextField('Street Address')
     city = TextField('City')
     zip = TextField('Zip Code', [validators.Required()])
     username = TextField('Username/Login', [
         validators.Required(),
         validators.Length(min=3),
         validators.NoneOf(
             [user['login'] for user in users],
             message="Username is already in use, please choose another")
     ])
     password = PasswordField(
         'Password', [
             validators.Required(),
             validators.EqualTo('password_confirm',
                                message='Passwords must match')
         ],
         description=
         u"The default password is the one from the 'Need a Password' box below; remember this (or write it down), since it will also be your password for Moodle & discussion groups!"
     )
     password_confirm = PasswordField('Repeat Password')
     emergency_contact_name = TextField('Name')
     emergency_contact_phone = TextField('Phone #')
     action = HiddenField()
Example #7
0
    def generate_add_user_form(self, page):
        page_fieldz = Field.query.filter_by(page_id=page.id, edit=True).all()
        uid = TextField(u'Login (uid)')

        class EditForm(Form):
            wrk_groupz = FormField(SelectGroupzForm,
                                   label=u"Groupes de travail")

        for field in page_fieldz:
            self.append_fieldlist_to_form(field, EditForm, page.label)
        existing_userz = [
            user.get_attributes()['uid'][0]
            for user in self.ldap.get_all_users()
        ]
        setattr(
            EditForm, "uid",
            TextField("Login",
                      validators=[
                          validators.NoneOf(
                              existing_userz,
                              message=u"L'utilisateur existe déjà"),
                          validators.Required("Champ obligatoire")
                      ]))
        form = EditForm(request.form)
        return form
Example #8
0
class StoreForm(StoreBaseForm):
    region = RegionField(label=_('Region'),
                         limit_allowed=True,
                         validators=[
                             validators.NoneOf(
                                 ['0'],
                                 message='Bitte geben Sie eine Region an')
                         ])
Example #9
0
class AddDevice(Form):
    mac = StringField('mac',
                      validators=[
                          validators.DataRequired(),
                          validators.MacAddress(),
                          validators.NoneOf(
                              ['00:00:00:00:00:00', 'FF:FF:FF:FF:FF:FF'],
                              message='Mac must be valid.')
                      ])
Example #10
0
 def generate_add_project_group_form(self):
     existing_groupz = [
         group.get_attributes()['cn'][0]
         for group in self.ldap.get_all_groups()
     ]
     self.set_validators_to_form_field(AddProjectGroupForm, 'cn',
                                       [validators.NoneOf(existing_groupz)])
     form = AddProjectGroupForm(request.form)
     form.responsable.choices = self.get_posix_userz_choices('cines')
     return form
Example #11
0
class EditForm(FlaskForm):

    choices = MultiCheckboxField('Routes')

    designer = fields.SelectField(
        "Move to Designers Inventory:",
        choices=[],
        validators=[validators.optional(),
                    validators.NoneOf((None, "EMPTY"))])

    client = fields.SelectField(
        "Pick Client too:",
        choices=[],
        validators=[validators.optional(),
                    validators.NoneOf((None, "EMPTY"))])

    delete = fields.SubmitField("Delete Checked Items")

    move = fields.SubmitField("Move to Chosen Inventory")
Example #12
0
 def generate_add_group_form(self):
     existing_groupz = [
         group.get_attributes()['cn'][0]
         for group in self.ldap.get_all_groups()
     ]
     self.set_validators_to_form_field(AddGenericGroupForm, 'cn',
                                       [validators.NoneOf(existing_groupz)])
     form = AddGenericGroupForm(request.form)
     form.filesystem.choices = self.get_filesystem_choices()
     return form
Example #13
0
class RestaurantForm(Form):
    title = StringField('Restaurant Name and location', [validators.NoneOf(listOfRestNames, message = 'Restaurant identifier is already taken'), validators.Length(min =1, max = 100)])
    yelp_url = StringField('Yelp URL', [
        validators.Optional(),
        validators.URL(message='Invalid url, leave blank if none exists.')] )
    open_table_url = StringField('Open Table URL', [
        validators.Optional(),
        validators.URL(message='Invalid url, leave blank if none exists.')] )
    google_url = StringField('Google URL', [
        validators.Optional(),
        validators.URL(message='Invalid url, leave blank if none exists.')] )
Example #14
0
 def generate_add_base_group_form(self, page_fieldz):
     for field in page_fieldz:
         self.append_field_to_form(field, AddBaseGroupForm)
     existing_groupz = [
         group.get_attributes()['cn'][0]
         for group in self.ldap.get_all_groups()
     ]
     self.set_validators_to_form_field(AddBaseGroupForm, 'cn',
                                       [validators.NoneOf(existing_groupz)])
     form = AddBaseGroupForm(request.form)
     return form
Example #15
0
File: app.py Project: fabines/tapud
class orderForm(Form):
    customer = StringField('Customer', [validators.required()])
    amount = IntegerField('Amount', [validators.required()])
    # type = StringField('Type', [validators.Length(min=4, max=25)])
    default = [('1', "select species")]
    default.extend(newSpecies)
    variety = SelectField(
        'Variety',
        [validators.NoneOf(['1'], message="you must select species")],
        choices=default)
    date = DateField('Date', format='%Y-%m-%d')
    organic = BooleanField('Organic', [validators.AnyOf([True, False])])
Example #16
0
class AddtrainerForm(Form):
	name = StringField('Name', [validators.Length(min = 1, max = 100)])
	username = StringField('Username', [validators.InputRequired(), validators.NoneOf(values = values, message = "Username already taken, Please try another")])
	password = PasswordField('Password', [
		validators.DataRequired(),
		validators.EqualTo('confirm', message = 'Passwords aren\'t matching pal!, check \'em')
	])
	confirm = PasswordField('Confirm Password')
	street = StringField('Street', [validators.Length(min = 1, max = 100)])
	city = StringField('City', [validators.Length(min = 1, max = 100)])
	prof = 3
	phone = StringField('Phone', [validators.Length(min = 1, max = 100)])
Example #17
0
class RegisterForm(Form):
    name = StringField('Name', [validators.Length(min =1, max=50)])
    username = StringField('Username', [
        validators.Length(min =4, max=25),
        validators.NoneOf(listOfUsernames ,message = 'Username Taken')#unique username checker
    ])
    email = StringField('Email', [validators.Length(min =6, max = 50)])
    password = PasswordField('Password', [
        validators.DataRequired(),
        validators.EqualTo('confirm', message = 'Passwords do not matchh')
    ])
    confirm = PasswordField('Confirm Password')
Example #18
0
class BaseLookupForm(Form):

    street_address = StringField(
        'Street address',
        validators=[
            validators.DataRequired(message="Street address is required."),
            validators.Length(min=1, max=256)
        ])
    street_address2 = StringField('Apt/Suite')
    city = StringField('City', [
        validators.DataRequired(message="City is required."),
        validators.Length(min=1, max=256)
    ])
    state = MySelectField(
        'State',
        choices=[('State', 'State')] +
        [(state, state) for state in sorted(usps.CODE_TO_STATE.keys())],
        validators=[
            validators.NoneOf(['State'], message='Please select a state.')
        ],
        option_widget=MyOption())
    zip5 = StringField('Zipcode', [
        validators.Regexp(
            re.compile('^\d{5}$'),
            message=
            'Zipcode and Zip+4 must have form XXXXX-XXXX. Lookup up <a target="_blank" href="https://tools.usps.com/go/ZipLookupAction!input.action">here</a>'
        )
    ])
    zip4 = StringField('Zip 4', [
        validators.Regexp(
            re.compile('^\d{4}$'),
            message=
            'Zipcode and Zip+4 must have form XXXXX-XXXX. Lookup up <a target="_blank" href="https://tools.usps.com/go/ZipLookupAction!input.action">here</a>'
        )
    ])

    def _autocomplete_zip(self):
        zipdata = self.zip5.data.split('-')
        try:
            self.zip5.data = zipdata[0]
        except:
            self.zip5.data = ''
        try:
            self.zip4.data = zipdata[1]
        except:
            self.zip4.data = ''

    def validate(self):
        self._autocomplete_zip()
        validation = super(BaseLookupForm, self).validate()
        if not validation:
            self.zip5.data = self.zip5.data + '-' + self.zip4.data
        return validation
Example #19
0
class AddMemberForm(Form):
    username = StringField('Username', [
        validators.InputRequired(),
        validators.NoneOf(values=values,
                          message="Username already taken, Please try another")
    ])
    password = PasswordField('Password', [
        validators.DataRequired(),
        validators.EqualTo('confirm', message='Passwords do not match')
    ])
    confirm = PasswordField('Confirm Password')
    membership_no = IntegerField(
        'Membership No.', [validators.NumberRange(min=9999, max=100001)])
Example #20
0
class AddMemberForm(Form):
    name = StringField('Name', [validators.Length(min=1, max=50)])
    username = StringField('Username', [validators.InputRequired(), validators.NoneOf(values = values, message = "Username already taken, Please try another")])
    password = PasswordField('Password', [
        validators.DataRequired(),
        validators.EqualTo('confirm', message='Passwords do not match')
    ])
    confirm = PasswordField('Confirm Password')
    plan  = RadioField('Select Plan', choices = choices)
    trainer = SelectField('Select trainer', choices = choices2)
    street = StringField('Street', [validators.Length(min = 1, max = 100)])
    city = StringField('City', [validators.Length(min = 1, max = 100)])
    phone = StringField('Phone', [validators.Length(min = 1, max = 100)])
Example #21
0
class GasExperiencesForm(Form):
    date = DateField('Date of experience', format='%Y-%m-%d')
    smell = RadioField('Could you smell the vumo?',
                       choices=[('Yes', 'Yes'), ('No', 'No')])
    throat = RadioField('Could you feel the vumo in your throat? For example burning or itching',\
       choices=[('Yes','Yes'),('No','No')])
    eyes = RadioField('Could you feel the vumo in your eyes? For example burning or itching',\
       choices=[('Yes','Yes'),('No','No')])
    skin = RadioField('Could you feel the vumo on your skin? For example burning or itching',\
       choices=[('Yes','Yes'),('No','No')])
    tired = RadioField('Did the vumo make you unusually tired?',\
       choices=[('Yes','Yes'),('No','No')])
    nausea = RadioField('Did the vumo make you feel nauseous?',\
       choices=[('Yes','Yes'),('No','No')])
    otherObs = TextAreaField('Could you see the vumo? What did it look like?\
       For example colour, visibility. You can write any other observations in this box'                                                                                        ,\
       [validators.Length(min=0, max=500)])
    windDir = SelectField('Where was the wind coming from when you felt the vumo?',\
       [validators.NoneOf(('blank'),message='Please select')],\
       choices=[('blank','--Please select--'),('N', 'North'), ('NE', 'Northeast'),\
       ('E', 'East'), ('SE', 'Southeast'), ('S', 'South'), ('SW', 'Southwest'),\
       ('W', 'West'), ('NW', 'Northwest'), ("Dont know", "Don't know")])
    windSpeed = SelectField('How strong was the wind when you felt the vumo?',\
       [validators.NoneOf(('blank'),message='Please select')],\
       choices=[('blank','--Please select--'),('No wind', 'No wind'), ('Slow wind', 'Slow wind'),\
       ('Strong wind', 'Strong wind'), ('Very strong wind', 'Very strong wind'), ("Dont know", "Don't know")])
    precip=SelectField('Was there any precipitation when you felt the vumo?',\
       [validators.NoneOf(('blank'),message='Please select')],\
       choices=[('blank','--Please select--'),('No precipitation', 'No precipitation'), ('Light rain', 'Light rain'),\
       ('Rain', 'Rain'),("Dont know", "Don't know")])
    latitude = DecimalField('Latitude', [
        validators.NumberRange(
            min=10, max=16, message="Latitude out of bounds")
    ])
    longitude = DecimalField('Longitude', [
        validators.NumberRange(
            min=-88, max=-82, message="Longitude out of bounds")
    ])
Example #22
0
class FileReportForm(FlaskForm):
    name = StringField(
        'Ihr Name',
        [
            validators.DataRequired(
                message='Bitte geben Sie einen Namen ein.'
            )
        ]
    )
    email = StringField(
        'Ihre E-Mail',
        [
            validators.Email(
                message='Bitte geben Sie eine E-Mail an.'
            )
        ]
    )
    website = StringField(
        label='Ihre Website'
    )
    hash = StringField(
        label='Hash'
    )
    reason = SelectField(
        'Grund für die Meldung',
        [
            validators.NoneOf(
                '0',
                'Bitte wählen Sie eine Kategorie.'
            )
        ],
        choices=[
            ('0', 'bitte wählen'),
            ('1', 'Urheberrechtsverletzung'),
            ('2', 'Personenbezogene Daten'),
            ('3', 'Sachlich fehlerhafte Angaben'),
            ('4', 'Sonstiges')
        ],

    )
    details = TextAreaField(
        'Ihre Nachricht',
        [
            validators.DataRequired(
                message='Bitte geben Sie einen Nachricht ein.'
            )
        ]
    )
    submit = SubmitField('Datei melden')
Example #23
0
class HarvestForm(Form):
    date = fields.DateTimeField('Date',
                                id="date",
                                format='%Y-%m-%d',
                                validators=[validators.required()])
    section_from = extfields.ExtendedSelectField(
        'From Field Section',
        id='section_from',
        validators=[
            validators.NoneOf(-1, message="Please select a field"),
            validators.required()
        ])
    bin_to = fields.SelectField('To Bin',
                                id='bin_to',
                                choices=[],
                                validators=[validators.required()])
    amount = fields.FloatField('Size in tonnes',
                               validators=[validators.required()])
Example #24
0
class RegistrationForm(Form):
    name = StringField(
        "Team Name",
        [validators.DataRequired(),
         validators.Length(min=4, max=35)])
    email = StringField("Email", [
        validators.DataRequired(),
        validators.Email(),
        validators.Length(min=6, max=35)
    ])
    username = StringField("Username", [
        validators.DataRequired(),
        validators.NoneOf(["admin"]),
        validators.Length(min=4, max=20)
    ])
    password = PasswordField(
        "Password",
        [validators.DataRequired(),
         validators.Length(min=4, max=35)])
Example #25
0
class GuestForm(Form):

    state_choices = [('0', '- Escolha o estado -'), ('sp', 'SP'), ('rj', 'RJ')]
    description = TextAreaField('Descrição'.decode('utf-8'), [validators.Length(max=800)])
    work = BooleanField('Eu trabalho')
    study = BooleanField('Eu estudo')
    pet = BooleanField('Possuo animais')
    car = BooleanField('Possuo carro/moto)')
    smoking = BooleanField('Sou fumante')
    gender = SelectField('Sexo', choices=[('M', 'Homem'), ('F', 'Mulher')])
    age = IntegerField('Idade', [validators.InputRequired(), validators.NumberRange(min=18, message='Você precisa ser maior de 18 anos'.decode('utf-8'))])
    state = SelectField('Estado', choices=state_choices, default=0, validators=[validators.NoneOf(values=['0'], message='Selecione um Estado')])
    city = SelectField('Cidade', coerce=int, default=1, validators=[validators.NumberRange(min=2, message='Selecione uma Cidade')])
    maxValue = IntegerField("Valor Máximo".decode('utf-8'), [validators.InputRequired()])


    def getObj(self, guest):
        guest.age = self.age.data
        guest.gender = self.gender.data
        guest.description = self.description.data
        guest.maxValue = self.maxValue.data
        guest.work = self.work.data
        guest.study = self.study.data
        guest.pet = self.pet.data
        guest.smoking = self.smoking.data
        guest.car = self.car.data
        guest.city_id = self.city.data
        return guest

    def populateForm(self, guest):
        self.description.data = guest.description
        self.work.data = guest.work
        self.study.data = guest.study
        self.pet.data = guest.pet
        self.car.data = guest.car
        self.smoking.data = guest.smoking
        self.gender.data = guest.gender
        self.age.data = guest.age
        city_temp = db.session.query(City).filter(City.id == guest.city_id).one()
        self.state.data = city_temp.state
        self.city.data = guest.city_id
        self.maxValue.data = guest.maxValue
Example #26
0
class ServiceForm(FlaskForm):
    image = FileField('Image', [
        FileRequired(),
        FileAllowed(['png', 'jpg', 'jpeg'], 'You can upload only images!')
    ])
    name = StringField('Name',
                       [validators.DataRequired(),
                        validators.Length(max=60)])
    id = StringField('Id', [
        validators.DataRequired(),
        validators.NoneOf(' '),
        validators.Length(max=60)
    ])
    description = TextAreaField(
        'Description',
        [validators.DataRequired(),
         validators.Length(min=10, max=400)])
    sms_number = SelectField('Price (PLN)',
                             choices=choices,
                             validators=[validators.DataRequired()])
    rewards = TextAreaField('Commands to execute after purchase')
Example #27
0
class RegisterForm(Form):
    usernames = [user.username for user in User.query.all()]
    name = StringField(
        'Name', [validators.DataRequired(),
                 validators.Length(min=1, max=50)])
    username = StringField('Username', [
        validators.DataRequired(),
        validators.Length(min=4, max=25),
        validators.NoneOf(usernames, message="username taken!")
    ])
    email = StringField('Email', [
        validators.DataRequired(),
        validators.Email(),
        validators.Length(min=6, max=100)
    ])
    password = PasswordField('Password', [
        validators.DataRequired(),
        validators.EqualTo('confirm',
                           message='The passwords need to match yo'),
        validators.Length(min=8, max=100)
    ])
    confirm = PasswordField('Confirm Password')
Example #28
0
class SignupForm(FlaskForm):
    name = StringField(
        label='Fullname',
        validators=[validators.DataRequired(),
                    validators.Length(1, 128)])
    username = StringField(
        'Username',
        validators=[validators.DataRequired(),
                    validators.Length(2)])
    email = StringField(
        label='Email',
        validators=[
            validators.DataRequired(),
            validators.Email(message='Enter a valid email address')
        ])
    password = PasswordField(label='Password',
                             validators=[
                                 validators.DataRequired(),
                                 validators.Length(min=8),
                                 validators.NoneOf(['password', '12345678'],
                                                   message='invalid password!')
                             ])
    password2 = PasswordField(
        label='Confirm Password',
        validators=[validators.DataRequired(),
                    validators.EqualTo('password')])
    submit = SubmitField('Register')

    def validate_email(self, field):
        if User.query.filter_by(email=field.data).first():
            raise ValidationError('Email already registered!')

    # def validate_name(self, field):
    #   if User.query.filter_by(name=field.name).first():
    #     raise ValidationError('Username in use!')

    def validate_username(self, field):
        if User.query.filter_by(username=field.data).first() is not None:
            raise ValidationError('This username already exists!')
Example #29
0
class Tasks_Form(Form):
    code = StringField(u'*Task Code', [validators.InputRequired()],
                       render_kw={"placeholder": "e.g. T-R1.1.1"})
    description = TextAreaField(u'*Description', [validators.InputRequired()],
                                render_kw={
                                    "placeholder":
                                    "e.g. Development of reporting \
template for baselining the current provision of forecasts."
                                })
    responsible_partner = SelectField(
        u'*Responsible Partner',
        [validators.NoneOf(('blank'), message='Please select')])
    month_due = IntegerField(u'Month Due', [
        validators.NumberRange(
            min=0,
            max=endMonth,
            message="Must be between 0 and " + str(endMonth))
    ])
    progress = TextAreaField(u'Progress', validators=[validators.Optional()])
    percent = IntegerField(u'*Percentage Complete', [
        validators.NumberRange(
            min=0, max=100, message="Must be between 0 and 100")
    ])
Example #30
0
class CampaignForm(w.Form):
    search_key = f.StringField(
        'Search Key',
        validators=[v.InputRequired('Search Key is a required field')],
    )

    latitude = f.FloatField(
        'Latitiude',
        validators=[
            v.Optional(),
            v.NumberRange(min=-180, max=180),
        ],
        id='latitude',
    )

    longitude = f.FloatField(
        'Longitude',
        validators=[
            v.Optional(),
            v.NumberRange(min=-180, max=180),
        ],
        id='longitude',
    )

    radius = f.FloatField(
        'Radius (mi)',
        validators=[
            v.Optional(),
            v.NumberRange(min=0),
            v.NoneOf([
                0,
            ]),
        ],
        id='radius',
    )

    submit = f.SubmitField('Submit')