예제 #1
0
class AdvancedSearchForm(SearchForm):
    q = StringField(
        _l('Suche')
    )  # query string is not DataRequired here since someone might want to search on other criteria
    lemma_search = BooleanField(_l('Lemma'))
    fuzziness = SelectField(_l("Unschärfegrad"),
                            choices=[("0", '0'), ("1", "1"), ("2", '2'),
                                     ('AUTO', _('AUTO'))],
                            default="0")
    slop = IntegerField(
        _l("Suchradius"),
        validators=[
            validate_optional_number_range(
                min=0,
                max=100,
                message=_l('Der Suchradius muss zwischen 0 und 100 liegen'))
        ],
        default=0)
    in_order = BooleanField(_l('Wortreihenfolge beachten?'))
    corpus = SelectMultipleField(_l('Corpora'),
                                 choices=[('all', _l('Alle')),
                                          ('chartae', _l('Urkunden')),
                                          ('formulae', _l('Formeln'))])
    year = StringField(
        _l('Jahr'),
        validators=[
            validate_optional_number_range(
                min=500,
                max=1000,
                message=_l('Die Jahreszahl muss zwischen 500 und 1000 liegen'))
        ],
        default="")
    month = SelectField(_l('Monat'),
                        choices=[
                            (0, '...'), (1, _l('Jan')), (2, _l('Feb')),
                            (3, _l('Mär')), (4, _l('Apr')), (5, _l('Mai')),
                            (6, _l('Jun')), (7, _l('Jul')), (8, _l('Aug')),
                            (9, _l('Sep')), (10, _l('Okt')), (11, _l('Nov')),
                            (12, _l('Dez'))
                        ],
                        default=0,
                        coerce=int)
    day = StringField(
        _l('Tag'),
        validators=[
            validate_optional_number_range(
                min=1,
                max=31,
                message=_l('Das Datum muss zwischen 1 und 31 liegen'))
        ],
        default="")
    year_start = StringField(
        _l('Jahr'),
        validators=[
            validate_optional_number_range(
                min=500,
                max=1000,
                message=_l('Die Jahreszahl muss zwischen 500 und 1000 liegen'))
        ],
        default="")
    month_start = SelectField(_l('Monat'),
                              choices=[(0, '...'), (1, _l('Jan')),
                                       (2, _l('Feb')), (3, _l('Mär')),
                                       (4, _l('Apr')), (5, _l('Mai')),
                                       (6, _l('Jun')), (7, _l('Jul')),
                                       (8, _l('Aug')), (9, _l('Sep')),
                                       (10, _l('Okt')), (11, _l('Nov')),
                                       (12, _l('Dez'))],
                              default=0,
                              coerce=int)
    day_start = StringField(
        _l('Tag'),
        validators=[
            validate_optional_number_range(
                min=1,
                max=31,
                message=_l('Das Datum muss zwischen 1 und 31 liegen'))
        ],
        default="")
    year_end = StringField(
        _l('Jahr'),
        validators=[
            validate_optional_number_range(
                min=500,
                max=1000,
                message=_l('Die Jahreszahl muss zwischen 500 und 1000 liegen'))
        ],
        default="")
    month_end = SelectField(_l('Monat'),
                            choices=[(0, '...'), (1, _l('Jan')),
                                     (2, _l('Feb')), (3, _l('Mär')),
                                     (4, _l('Apr')), (5, _l('Mai')),
                                     (6, _l('Jun')), (7, _l('Jul')),
                                     (8, _l('Aug')), (9, _l('Sep')),
                                     (10, _l('Okt')), (11, _l('Nov')),
                                     (12, _l('Dez'))],
                            default=0,
                            coerce=int)
    day_end = StringField(
        _l('Tag'),
        validators=[
            validate_optional_number_range(
                min=1,
                max=31,
                message=_l('Das Datum muss zwischen 1 und 31 liegen'))
        ],
        default="")
    date_plus_minus = IntegerField(
        _l('Datum Plus-Minus'),
        validators=[
            validate_optional_number_range(
                min=0,
                max=100,
                message=_l('Plus-Minus muss zwischen 0 und 100 Jahren liegen'))
        ],
        default=0)
    exclusive_date_range = BooleanField(_l('Exklusiv'))
    composition_place = StringField(_l('Ausstellungsort'))
    special_days = SelectMultipleField(_l('Nach bestimmten Tagen suchen'),
                                       choices=[('', ''),
                                                ('Easter', _l('Ostern')),
                                                ('Lent', _l('Fastenzeit')),
                                                ('Pentecost', _l('Pfingsten')),
                                                ('Sunday', _l('So')),
                                                ('Monday', _l('Mo')),
                                                ('Tuesday', _l('Di')),
                                                ('Wednesday', _l('Mi')),
                                                ('Thursday', _l('Do')),
                                                ('Friday', _l('Fr')),
                                                ('Saturday', _l('Sa'))])
    submit = SubmitField(_l('Suche'))
예제 #2
0
class UpdateAccountForm(FlaskForm):
    '''Update Account form'''
    username = StringField(
        'Username',
        validators=[
            DataRequired(),
            Length(3,
                   20,
                   message='Username must be between 3 and 20 characters')
        ])
    email = StringField('Email', validators=[DataRequired(), Email()])
    fname = StringField(
        'First Name',
        validators=[
            DataRequired(),
            Length(3,
                   20,
                   message='First Name must be between 3 and 20 characters')
        ])
    lname = StringField(
        'Last  Name',
        validators=[
            DataRequired(),
            Length(3,
                   20,
                   message='Last Name must be between 3 and 20 characters')
        ])
    address = TextAreaField('Address', validators=[DataRequired()])
    profile_picture = FileField(
        'Upload Profile Picture',
        validators=[
            FileAllowed(['png', 'jpg'],
                        message='File must be a png or jpg file')
        ])
    resume = FileField('Upload Resume',
                       validators=[
                           FileAllowed(
                               ['pdf', 'docx'],
                               message='File must be a png or jpg file')
                       ])
    is_admin = BooleanField('Are you an Admin')
    is_actively_interviewing = BooleanField(
        'Are you actively in search for job')
    facebook_link = StringField('Facebook url', validators=[url()])
    twitter_link = StringField('Twitter url', validators=[url()])
    linkedin_link = StringField('Linkedin url', validators=[url()])
    is_recruiter = BooleanField('Are you a recruiter')
    skills = SelectMultipleField('Skills',
                                 choices=[(1, 'C++'), (2, 'Python'),
                                          (3, 'JavaScript'), (4, 'Java'),
                                          (5, 'React'), (6, 'Golang'),
                                          (7, 'Rust')],
                                 coerce=int)
    interests = SelectMultipleField('Interests',
                                    choices=[(1, 'Product Design'),
                                             (2, 'UI/UX'),
                                             (3, 'Software Development'),
                                             (4, 'Artificial Intelligence'),
                                             (5, 'Data Science'),
                                             (6, 'Game Development'),
                                             (7, 'Cyber Security')],
                                    coerce=int)
    salary = IntegerField('Expected Salary')
    phone = TelField('Phone Number')
    submit = SubmitField('Update profile')

    def validate_username(self, username):
        '''Ensures that the username chosen by the user hasn't been registered to the database.'''

        # If the username has been registered to the db, an error will be raised in the html form
        if username.data != current_user.username:
            user = User.query.filter_by(username=username.data).first()
            if user:
                raise ValidationError('Username taken. Please choose another.')

    def validate_email(self, email):
        if email.data != current_user.email:
            user = User.query.filter_by(email=email.data).first()
            if user:
                raise ValidationError('Email is taken, please choose another')
예제 #3
0
파일: forms.py 프로젝트: rje4242/indico
class CloneRepeatPatternForm(CloneRepeatUntilFormBase):
    week_day = IndicoWeekDayRepetitionField(_('Every'))
    num_months = IntegerField(
        _('Months'), [DataRequired(), NumberRange(min=1)],
        default=1,
        description=_("Number of months between repetitions"))
예제 #4
0
파일: form.py 프로젝트: mitcom/counter
from wtforms import BooleanField, Form, RadioField, SubmitField
from wtforms.fields.html5 import IntegerField, IntegerRangeField

MAX_MOVE = 16


class MovesForm(Form):
    is_z = BooleanField('Czy jest sygnał Z?')
    num = IntegerRangeField('Ile jest stanów?')
    ff_type = RadioField('Jaki jest typ przerzutnika?',
                         default='jk',
                         choices=(('jk', 'JK'), ('d', 'D'), ('t', 'T')))
    solve = SubmitField('SOLVE!')

    def get_field(self, x, y):
        field = 'move_{}_{}'.format(x, y)
        return vars(self)[field](min=0, max=MAX_MOVE - 1)


for i in range(2):
    for j in range(MAX_MOVE):
        move = 'move_{}_{}'.format(i, j)
        setattr(MovesForm, move, IntegerField())
예제 #5
0
class AddDiagnosisForm(FlaskForm):
    patient_number = IntegerField('Patient Number',
                                  validators=[DataRequired()])
    ailment = TextAreaField('Ailment', validators=[DataRequired()])
    treatment = TextAreaField('Ailment', validators=[DataRequired()])
    submit = SubmitField('Add Diagnosis')
예제 #6
0
class PaymentForm(BasePaymentForm):
    """Payment form for organizations."""
    invoice_number = IntegerField(
        validators=[DataRequired("You need to specify invoice number!")])
예제 #7
0
class IntegerWidget(BaseWidget):
    field = IntegerField()
    field_kwargs = {"style": "max-width: 100px;"}
예제 #8
0
class survey_form(FlaskForm):
    site = SelectField(label='Site',
                       coerce=int,
                       choices=[],
                       validators=[DataRequired()])
    date = DateField(label='Date', validators=[DataRequired()])
    crew = IntegerField(label='Crew Count',
                        validators=[NumberRange(min=1, max=6),
                                    DataRequired()])
    time_in = TimeField(label='Time In', validators=[DataRequired()])
    time_out = TimeField(label='Time Out', validators=[DataRequired()])
    precentage_surveyed = IntegerField(
        label='Precentage Surveyed',
        default=0,
        validators=[NumberRange(min=0, max=100),
                    DataRequired()])
    method = SelectField(label='Method',
                         choices=[
                             ('foot', 'Foot'),
                             ('boat', 'Boat'),
                             ('peeking', 'Peeking'),
                         ],
                         validators=[DataRequired()])
    ac1 = IntegerField(label='Adult Tern Count 1',
                       default=0,
                       validators=[NumberRange(min=0),
                                   InputRequired()])
    ac2 = IntegerField(label='Adult Tern Count 2',
                       default=0,
                       validators=[NumberRange(min=0),
                                   InputRequired()])
    ac3 = IntegerField(label='Adult Tern Count 3',
                       default=0,
                       validators=[NumberRange(min=0),
                                   InputRequired()])
    egg1 = IntegerField(label='Nest(s) with 1 Egg',
                        default=0,
                        validators=[NumberRange(min=0),
                                    InputRequired()])
    egg2 = IntegerField(label='Nest(s) with 2 Egg',
                        default=0,
                        validators=[NumberRange(min=0),
                                    InputRequired()])
    egg3 = IntegerField(label='Nest(s) with 3 Egg',
                        default=0,
                        validators=[NumberRange(min=0),
                                    InputRequired()])
    scrape = BooleanField(label='Scrape Presence',
                          default=False,
                          validators=[
                              Optional(),
                          ])
    chick02 = IntegerField(label='Chicks 0-2 day(s) old',
                           default=0,
                           validators=[NumberRange(min=0),
                                       InputRequired()])
    chick39 = IntegerField(label='Chicks 3-9 days old',
                           default=0,
                           validators=[NumberRange(min=0),
                                       InputRequired()])
    chick1017 = IntegerField(label='Chicks 10-17 days old',
                             default=0,
                             validators=[NumberRange(min=0),
                                         InputRequired()])
    fledgling = IntegerField(label='Fledglings',
                             default=0,
                             validators=[NumberRange(min=0),
                                         InputRequired()])
    ef_choices = [
        ('NA', 'N/A'),
        ('a', 'a'),
        ('b', 'b'),
        ('c', 'c'),
        ('d', 'd'),
        ('e', 'e'),
        ('f', 'f'),
        ('g', 'g'),
        ('h', 'h'),
        ('i', 'i'),
        ('i+', 'i+'),
    ]
    ef1 = SelectField(label='Egg Float #1',
                      choices=ef_choices,
                      validators=[
                          Optional(),
                      ])
    ef2 = SelectField(label='Egg Float #2',
                      choices=ef_choices,
                      validators=[
                          Optional(),
                      ])
    ef3 = SelectField(label='Egg Float #3',
                      choices=ef_choices,
                      validators=[
                          Optional(),
                      ])
    ef4 = SelectField(label='Egg Float #4',
                      choices=ef_choices,
                      validators=[
                          Optional(),
                      ])
    vegetation_choices = [
        ('none', 'none'),
        ('grass', 'Grass'),
        ('herb', 'Herb'),
        ('vine', 'Vine'),
        ('woody', 'Woody'),
        ('treey', 'Trees'),
    ]
    primary_vegitation = SelectField(label='Primary Vegetation',
                                     choices=vegetation_choices,
                                     validators=[DataRequired()])
    precentage_primary_vegitation = IntegerField(
        label='Precentage Vegetation',
        default=0,
        validators=[NumberRange(min=0, max=100),
                    InputRequired()])
    size_type = SelectField(label='Size',
                            coerce=int,
                            choices=[(1, 'Small'), (2, 'Medium'),
                                     (3, 'Large')],
                            validators=[DataRequired()])
    cwdn1 = IntegerField(label='Course Woody Debris - Nest 1',
                         default=0,
                         validators=[NumberRange(min=0),
                                     InputRequired()])
    cwdn2 = IntegerField(label='Course Woody Debris - Nest 2',
                         default=0,
                         validators=[NumberRange(min=0),
                                     InputRequired()])
    cwdn3 = IntegerField(label='Course Woody Debris - Nest 3',
                         default=0,
                         validators=[NumberRange(min=0),
                                     InputRequired()])
    cwdlog = IntegerField(label='Course Woody Debris - Logs',
                          default=0,
                          validators=[NumberRange(min=0),
                                      InputRequired()])
    water_temp = DecimalField(places=1,
                              label='Water Temperature',
                              validators=[
                                  Optional(),
                              ])
    ambient_temp = DecimalField(places=1,
                                label='Ambient Temperature',
                                validators=[
                                    Optional(),
                                ])
    precentage_disolved_oxygen = DecimalField(places=1,
                                              label='% Disolved Oxygen',
                                              validators=[
                                                  Optional(),
                                              ])
    salinity = DecimalField(places=2,
                            label='Salinity in ppt',
                            validators=[
                                Optional(),
                            ])
    specific_conductance = DecimalField(places=1,
                                        label='Specific Conductance',
                                        validators=[
                                            Optional(),
                                        ])
    conductivity = DecimalField(places=1,
                                label='Conductivity',
                                validators=[
                                    Optional(),
                                ])
    comment = TextAreaField(label='Comments',
                            default='',
                            validators=[
                                Optional(),
                            ])
    submit = SubmitField()
예제 #9
0
class site_form(FlaskForm):
    name = StringField(label='Site ID', validators=[DataRequired()])
    loc_type = SelectField(label='Location Type',
                           choices=[
                               ('rooftop', 'Rooftop'),
                               ('sandbar-island', 'Island - Sandbar'),
                               ('sandbar-main', 'Main - Sandbar'),
                           ],
                           validators=[DataRequired()])
    elevation = DecimalField(label='Elevation',
                             default=0,
                             validators=[InputRequired()])
    snag_perch = IntegerField(label='Snag/Perch Count',
                              default=0,
                              validators=[NumberRange(min=0),
                                          InputRequired()])
    substrate_choices = [
        ('silt_clay', 'Silt/Clay'),
        ('gravel', 'Gravel'),
        ('sand', 'Sand'),
        ('sm_rocks', 'Small Rocks'),
    ]

    primary_substrate = SelectField(label='Primary Substrate',
                                    choices=substrate_choices,
                                    validators=[DataRequired()])
    precentage_primary_substrate = IntegerField(
        label='Precentage Primary Substrate',
        default=0,
        validators=[NumberRange(min=0, max=100),
                    DataRequired()])
    silt_clay = BooleanField(label='Silt/Clay',
                             default=False,
                             validators=[
                                 Optional(),
                             ])
    sand = BooleanField(label='Sand', default=False, validators=[
        Optional(),
    ])
    gravel = BooleanField(label='Gravel',
                          default=False,
                          validators=[
                              Optional(),
                          ])
    sm_rocks = BooleanField(label='Small Rocks',
                            default=False,
                            validators=[
                                Optional(),
                            ])
    est_area = DecimalField(label='Estimated Area', validators=[
        Optional(),
    ])
    length = DecimalField(label='Length', validators=[
        Optional(),
    ])
    perimeter_length = DecimalField(label='Perimeter Length',
                                    validators=[
                                        Optional(),
                                    ])
    mainland_distance = DecimalField(label='Distnace to Mainland',
                                     validators=[
                                         Optional(),
                                     ])
    perimeter = BooleanField(label='Perimeter Taken',
                             default=False,
                             validators=[
                                 Optional(),
                             ])
    comment = TextAreaField(label='Comments',
                            default='',
                            validators=[
                                Optional(),
                            ])
    submit = SubmitField()
예제 #10
0
class PasswordForm(FlaskForm):
    telephone_number_field = TelField(validators=[DataRequired()])
    password_length_field = IntegerField(validators=[DataRequired()])
    send = SubmitField('Get password')
예제 #11
0
class IvrForm(BaseForm):
    name = StringField(l_('Name'),
                       validators=[InputRequired(),
                                   Length(max=128)])
    abort_destination = DestinationField(
        destination_label=l_('Abort destination'),
        description=l_(
            'The destination to redirect the caller to when the maximum number of tries is reached.\
                        If not set, the call will be hanged up after playing the abort sound (if set)'
        ))
    abort_sound = SelectField(
        l_('Abort sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_(
            'The sound played when the caller reach the maximum number of tries.\
                        Not used if an abort destination is set'))
    choices = FieldList(FormField(IvrChoiceForm))
    description = StringField(l_('Description'))
    greeting_sound = SelectField(
        l_('Greeting sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_('The sound played to greet the caller'))
    invalid_destination = DestinationField(
        destination_label=l_('Invalid destination'),
        description=l_(
            'The destination to redirect the caller to when he choose an invalid option.\
                        If not set, the menu will be replayed'))
    invalid_sound = SelectField(
        l_('Invalid Sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_(
            'The sound played when the caller choose an invalid option.\
                        Not used if an invalid destination is set'))
    max_tries = IntegerField(
        l_('Max tries'),
        default=3,
        validators=[NumberRange(min=1)],
        description=l_('The maximum number of tries before aborting the call.\
                        Both a timeout and an invalid choice counts toward the number of tries integer Default:3'
                       ))
    menu_sound = SelectField(
        l_('Menu Sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_('The sound played to prompt the caller for input'))
    timeout = IntegerField(
        l_('Timeout'),
        default=5,
        validators=[NumberRange(min=0)],
        description=l_(
            'Number of seconds to wait after the menu sound is played before either replaying the menu,\
                        redirecting the call to the timeout destination (if set) or aborting the call\
                        (if the maximum number of tries has been reached) integer Default:5'
        ))
    timeout_destination = DestinationField(
        destination_label=l_('Timeout destination'),
        description=l_(
            'The destination to redirect the caller to on timeout. If not set, the menu will be replayed'
        ))
    submit = SubmitField(l_('Submit'))

    def to_dict(self):
        data = super().to_dict()

        for field in [
                'abort_destination', 'invalid_destination',
                'timeout_destination'
        ]:
            if data.get(field, {}).get('type') == 'none':
                data[field] = None
        return data
예제 #12
0
class DepartmentsForm(FlaskForm):
    title = StringField('Название депортамента', validators=[DataRequired()])
    chief = IntegerField('ID начальника', validators=[DataRequired()])
    members = StringField('кто в этом депортаменте', validators=[DataRequired()])
    email = EmailField('Почта депортамента', validators=[DataRequired()])
    submit = SubmitField('Создать')
예제 #13
0
파일: forms.py 프로젝트: Richy8/automation
class OverheadCostForm(FlaskForm):
    overhead = IntegerField(
        'Overhead Cost',
        validators=[InputRequired(message='Field is Required')])
    submit = SubmitField('UPDATE')
예제 #14
0
class UploadForm(FlaskForm):
    wordlist = RadioField('Wordlist',
                          choices=wordlists_available(),
                          default=NONE_STR,
                          description="The higher the rate, the better")
    rule = RadioField('Rule', choices=Rule.to_form(), default=NONE_STR)
    timeout = IntegerField('Timeout in minutes, optional',
                           validators=[Optional(),
                                       NumberRange(min=1)])
    workload = RadioField("Workload",
                          choices=Workload.to_form(),
                          default=Workload.Default.value)
    brain = BooleanField(
        "Hashcat Brain",
        default=False,
        description="Hashcat Brain skips already tried password candidates")
    brain_client_feature = RadioField(
        "Brain client features",
        choices=BrainClientFeature.to_form(),
        default=BrainClientFeature.POSITIONS.value)
    capture = FileField(
        'Capture',
        validators=[
            FileRequired(),
            FileAllowed(HashcatMode.valid_suffixes(),
                        message='Airodump & Hashcat capture files only')
        ])
    submit = SubmitField('Submit')

    # TODO: pass render_kw=dict(disabled=True) in RadioField

    def __init__(self):
        super().__init__()
        self.wordlist.choices = wordlists_available()

    def get_wordlist_path(self):
        if self.wordlist.data == NONE_STR:
            return None
        return Path(self.wordlist.data)

    def get_wordlist_name(self):
        wordlist = find_wordlist_by_path(self.get_wordlist_path())
        if wordlist is None:
            return None
        return wordlist.name

    def get_rule(self):
        return Rule.from_data(self.rule.data)

    @property
    def runtime(self):
        runtime = estimate_runtime_fmt(wordlist_path=self.get_wordlist_path(),
                                       rule=self.get_rule())
        return runtime

    def hashcat_args(self, secret=False):
        hashcat_args = []
        if self.brain.data:
            hashcat_args.append("--brain-client")
            hashcat_args.append(
                f"--brain-client-features={self.brain_client_feature.data}")
            if secret:
                hashcat_args.append(
                    f"--brain-password={read_hashcat_brain_password()}")
        return hashcat_args

    @staticmethod
    def validate_wordlist(form, field):
        wordlist = field.data
        if wordlist is None:
            # fast mode
            return

        # update the wordlists
        wordlists_available()

        wordlist = find_wordlist_by_path(wordlist)
        if wordlist is None:
            raise ValidationError(
                f"The chosen wordlist does not exist anymore.")
예제 #15
0
파일: user.py 프로젝트: grigvlwork/py_prog
class VariantsForm(FlaskForm):
    amount = IntegerField('Количество вариантов в работе',
                          validators=[DataRequired()])
    submit = SubmitField('Сформировать файл')
예제 #16
0
class Field(FlaskForm):
    address = StringField("Ping adresa", validators=[DataRequired()])
    c = IntegerField("Počet pingů", default=4, validators=[DataRequired()])
    i = DecimalField("Interval pingů", default=1, validators=[DataRequired()])
    sub = SubmitField("Potvrdit", validators=[DataRequired()])
예제 #17
0
class GroupDestinationForm(BaseForm):
    set_value_template = '{group_name}'

    group_id = SelectField(l_('Group'), [InputRequired()], choices=[])
    ring_time = IntegerField(l_('Ring Time'), [NumberRange(min=0)])
    group_name = DestinationHiddenField()
예제 #18
0
class CreateForm(FlaskForm):
    img = FileField('Изображение')
    price = IntegerField('Цена')
    desc = StringField('Описание')
    in_stock = BooleanField('На складе')
    submit = SubmitField('Добавить товар')
class PlantRegistrationForm(Form):
    plant_type = SelectField('Plant Type')
    level = IntegerField('Plant Level')
    location = StringField('Plant Location', validators=[validators.Length(min=LOCATION_MIN_LENGTH, max=LOCATION_MAX_LENGTH)])
예제 #20
0
class NewGameForm(FlaskForm):
    generations_per_round = IntegerField('Number of generations per round')
    rounds_number = IntegerField('Number of rounds')
    new_cells_per_round = IntegerField('Number of cells to add on each round')
    submit = SubmitField('Start')
예제 #21
0
class DeleteReviewForm(FlaskForm):
    '''Form for a deleting review session.'''
    review_number = IntegerField('Delete study session',
                                 validators=[DataRequired()])
    del_review_submit = SubmitField('Delete session')
예제 #22
0
class ReviewForm(FlaskForm):
    rating = IntegerField(default=3,
                          validators=[DataRequired(),
                                      NumberRange(1, 5)])
    comment = TextAreaField('Comment', validators=[DataRequired()])
    submit = SubmitField('Post')
예제 #23
0
class LeadForm(Form):

    email = StringField('Email',
                        validators=[
                            DataRequired("Email is required"),
                            Length(min=3, max=25),
                            Email()
                        ],
                        render_kw={
                            "class": "required email",
                            "placeholder": "Enter Email"
                        })
    firstName = StringField('First Name',
                            validators=[
                                DataRequired("First name is required"),
                                Length(min=2, max=30)
                            ],
                            render_kw={
                                "class": "required",
                                'placeholder': 'Enter First Name'
                            })
    lastName = StringField('Last Name',
                           validators=[
                               DataRequired("Last name is required"),
                               Length(min=2, max=30)
                           ],
                           render_kw={
                               "class": "required",
                               'placeholder': 'Enter Last Name'
                           })
    address = StringField('Address',
                          validators=[
                              DataRequired("Address is required"),
                              Length(min=10, max=255)
                          ],
                          render_kw={
                              "class": "required",
                              'placeholder': 'Enter Address'
                          })
    city = StringField(
        'City',
        validators=[DataRequired("City is required"),
                    Length(min=1, max=55)],
        render_kw={
            "class": "required",
            'placeholder': 'Enter City Name'
        })
    phone = IntegerField('Phone Number',
                         validators=[
                             DataRequired("Zip code is required"),
                             Length(min=10, max=12)
                         ],
                         render_kw={
                             "class": "required ",
                             "placeholder": "Enter a Phone Number"
                         })
    zip = IntegerField('Zip Code',
                       validators=[
                           DataRequired("Zip code is required"),
                           Length(min=5, max=5)
                       ],
                       render_kw={
                           "class": "required ",
                           "placeholder": "Enter Zipcode"
                       })

    state = SelectField(
        'State',
        validators=[DataRequired("State is required"),
                    Length(min=2, max=2)],
        choices=US_STATE_LIST,
        render_kw={
            "class": "required width_178",
            'placeholder': 'Enter State',
            'value': 'Select a State'
        })

    country = HiddenField('Country',
                          validators=[DataRequired("Country is required")])
    submit_button = SubmitField("",
                                render_kw={
                                    'id': 'submit_button',
                                    'style': 'margin-top:10px;'
                                })
    c1 = HiddenField('C1')
    c2 = HiddenField('C2')
    c3 = HiddenField('C3')
예제 #24
0
파일: forms.py 프로젝트: szilveszterb/tbse
class SessionForm(FlaskForm):
    count = IntegerField("Turn count",
                         validators=[DataRequired(),
                                     NumberRange(min=1)])
    submit = SubmitField("Start new session", validators=[DataRequired()])
예제 #25
0
파일: activity.py 프로젝트: luckylark/catyy
class CreateActivityForm(Form):
    name = StringField('活动标题',
                       render_kw={'placeholder': '填写活动标题(100字以内)'},
                       validators=[DataRequired('必填字段'),
                                   Length(1, 100)])
    cover = FileField('活动封面(建议上传宽高比2:1的封面以获得最佳浏览效果)',
                      validators=[FileAllowed(coverPost, '请上传图片格式')])
    travel_type = MultiCheckboxField('使用了自定义字段的活动类型',
                                     coerce=int,
                                     validators=[DataRequired('请至少选择一个活动类型')])
    start_date = DateField('活动开始日期', validators=[DataRequired('必填字段')])
    end_date = DateField('活动结束日期',
                         validators=[DataRequired('必填字段')])  # 自动计算活动天数
    phone = StringField('咨询电话', validators=[Length(0, 15)])
    maximum = IntegerField('活动参与人数')  #TODO 不填为不限人数
    rally_site = StringField('活动集合地点',
                             render_kw={'placeholder': '填写活动集合地点(20字以内)'},
                             validators=[DataRequired('必填字段'),
                                         Length(1, 20)])
    destination = StringField('活动目的地',
                              render_kw={'placeholder': '填写活动目的地(20字以内)'},
                              validators=[DataRequired('必填字段'),
                                          Length(1, 20)])
    price = IntegerField('活动价格', render_kw={'placeholder': '填写活动价格(仅数字,不加单位)'})
    child_price = IntegerField('活动儿童价格', [Optional()],
                               render_kw={'placeholder': '填写活动价格(仅数字,不加单位)'})
    #TODO-------------指数选择改成star selector-----
    intensity_index = IntegerField('强度指数(请填写数字1-5)',
                                   default='5',
                                   render_kw={
                                       'min': '1',
                                       'max': '5'
                                   },
                                   validators=[
                                       DataRequired('必填字段'),
                                       NumberRange(min=1,
                                                   max=5,
                                                   message='数字只能在1-5之间')
                                   ])
    landscape_index = IntegerField('风景指数(请填写数字1-5)',
                                   default='5',
                                   render_kw={
                                       'min': '1',
                                       'max': '5'
                                   },
                                   validators=[
                                       DataRequired('必填字段'),
                                       NumberRange(min=1,
                                                   max=5,
                                                   message='数字只能在1-5之间')
                                   ])
    introduce = TextAreaField('活动介绍(上传图片请先压缩到1M以下大小)', [DataRequired('必填字段')])
    registration_way = MultiCheckboxField('报名方式', [DataRequired('必填项')],
                                          coerce=int)
    team_letter = TextAreaField('如果含团队报名,可以在这里输入只有团队领队可以看到的话')
    submit = SubmitField('发布活动')

    def __init__(self, activity=None, *args, **kwargs):
        super(CreateActivityForm, self).__init__(*args, **kwargs)
        self.travel_type.choices = [(item.id, item.name)
                                    for item in OutdoorType.show_list()]
        self.registration_way.choices = [(k, registration_way[k])
                                         for k in registration_way]
        self.activity = activity

    def validate_end_date(self, field):
        if field.data < self.start_date.data:
            raise ValidationError('活动结束日期必须晚于活动开始日期')

    def validate_start_date(self, field):
        if field.data < date.today():
            raise ValidationError('活动日期必须在今天之后')

    def validate_name(self, field):
        if self.activity and self.activity.name == field.data:
            return True
        if Activity.query.filter_by(name=field.data).count():
            raise ValidationError('您使用的活动名和站内其他活动重名啦!请修改一下活动名~')
예제 #26
0
class HangupBusyDestination(BaseForm):

    timeout = IntegerField(l_('Timeout'), [NumberRange(min=0)])
예제 #27
0
class SurveyForm(IndicoForm):
    _notification_fields = ('notifications_enabled', 'notify_participants',
                            'start_notification_emails',
                            'new_submission_emails')

    title = StringField(_("Title"), [DataRequired()],
                        description=_("The title of the survey"))
    introduction = TextAreaField(
        _("Introduction"),
        description=_("An introduction to be displayed before the survey"))
    anonymous = BooleanField(
        _("Anonymous submissions"),
        widget=SwitchWidget(),
        description=_("User information will not be attached to submissions"))
    require_user = BooleanField(
        _("Only logged-in users"), [HiddenUnless('anonymous')],
        widget=SwitchWidget(),
        description=_(
            "Require users to be logged in for submitting the survey"))
    limit_submissions = BooleanField(
        _("Limit submissions"),
        widget=SwitchWidget(),
        description=_("Whether there is a submission cap"))
    submission_limit = IntegerField(
        _("Capacity"), [
            HiddenUnless('limit_submissions'),
            DataRequired(),
            NumberRange(min=1)
        ],
        description=_("Maximum number of submissions accepted"))
    private = BooleanField(
        _("Private survey"),
        widget=SwitchWidget(),
        description=_("Only selected people can answer the survey."))
    partial_completion = BooleanField(
        _('Partial completion'),
        widget=SwitchWidget(),
        description=_('Allow to save answers without submitting the survey.'))
    notifications_enabled = BooleanField(
        _('Enabled'),
        widget=SwitchWidget(),
        description=_(
            'Send email notifications for specific events related to the '
            'survey.'))
    notify_participants = BooleanField(
        _('Participants'),
        [HiddenUnless('notifications_enabled', preserve_data=True)],
        widget=SwitchWidget(),
        description=_(
            'Notify participants of the event when this survey starts.'))
    start_notification_emails = EmailListField(
        _('Start notification recipients'),
        [HiddenUnless('notifications_enabled', preserve_data=True)],
        description=_(
            'Email addresses to notify about the start of the survey'))
    new_submission_emails = EmailListField(
        _('New submission notification recipients'),
        [HiddenUnless('notifications_enabled', preserve_data=True)],
        description=_(
            'Email addresses to notify when a new submission is made'))

    def __init__(self, *args, **kwargs):
        self.event = kwargs.pop('event')
        super(IndicoForm, self).__init__(*args, **kwargs)

    def validate_title(self, field):
        query = (Survey.query.with_parent(self.event).filter(
            db.func.lower(Survey.title) == field.data.lower(),
            Survey.title != field.object_data, ~Survey.is_deleted))
        if query.count():
            raise ValidationError(
                _('There is already a survey named "{}" on this event'.format(
                    escape(field.data))))

    def post_validate(self):
        if not self.anonymous.data:
            self.require_user.data = True
예제 #28
0
파일: user.py 프로젝트: grigvlwork/py_prog
class ToWorkForm(FlaskForm):
    # name = StringField('Название переменной', validators=[DataRequired()])
    amount = IntegerField('Количество задач', validators=[DataRequired()])
    submit = SubmitField('Добавить задачи в работу')
예제 #29
0
class AdvancedSearchForm(Form):

    compound_space_group_min = IntegerField("Compound space group min.", [
        validators.NumberRange(
            min=1, max=230, message='Min. number out of range')
    ],
                                            default=1)
    compound_space_group_max = IntegerField("Compound space group", [
        validators.NumberRange(
            min=1, max=230, message='Max. number out of range')
    ],
                                            default=230)

    saturation_magnetization_min = DecimalField(
        "Saturation magnetization min", [
            validators.NumberRange(
                min=0, max=100, message='Min. saturation out of range')
        ],
        default=0,
        places=2)
    saturation_magnetization_max = DecimalField("Saturation magnetization", [
        validators.NumberRange(
            min=0, max=100, message='Max. saturation out of range')
    ],
                                                default=100,
                                                places=2)

    apply_filter_k1 = BooleanField('Apply filter')

    magnetocrystalline_anisotropy_constant_k1_min = DecimalField(
        "Magnetocrystalline anisotropy constant K1 min", [
            validators.NumberRange(
                min=-1000,
                max=1000,
                message=
                'Min. magnetocrystalline anisotropy constant out of range')
        ],
        default=-1000,
        places=2)
    magnetocrystalline_anisotropy_constant_k1_max = DecimalField(
        "First magnetocrystalline anisotropy constant K<sub>1</sub>", [
            validators.NumberRange(
                min=-1000,
                max=1000,
                message=
                'Max. magnetocrystalline anisotropy constant out of range')
        ],
        default=1000,
        places=2)

    unit_cell_formation_enthalpy_min = DecimalField(
        "Unit cell formation enthalpy min.", [
            validators.NumberRange(
                min=-1000, max=1000, message='Min. enthalpy out of range')
        ],
        default=-1000,
        places=2)
    unit_cell_formation_enthalpy_max = DecimalField(
        "Unit cell formation enthalpy", [
            validators.NumberRange(
                min=-1000, max=1000, message='Max. enthalpy out of range')
        ],
        default=1000,
        places=2)

    atomic_species = StringField("Atomic species")

    species_count = IntegerField(
        "Species count",
        [validators.NumberRange(min=0, max=10, message='Number out of range')],
        default=3)

    stechiometry_value_min = DecimalField("Stoichiometry percentage min", [
        validators.NumberRange(
            min=0, max=1, message='Min. number out of range')
    ],
                                          default=0)
    stechiometry_value_max = DecimalField("Stoichiometry percentage", [
        validators.NumberRange(
            min=0, max=1, message='Min. number out of range')
    ],
                                          default=1)

    submit = SubmitField("Submit")

    stechiometry_atom = SelectField('Stoichiometry atom',
                                    coerce=str,
                                    choices=[(atom.symbol, atom.symbol)
                                             for atom in ATOMS],
                                    default='Fe')
예제 #30
0
class HourForm(FlaskForm):
    amount = IntegerField("Number of hours",
                          widget=NumberInput(min=0, max=24, step=0.5))
    work_date = DateField("Date of work", format="%YYYY-%m-%d")
    shortcut = SelectField("Project shortcut")
    confirm_button = SubmitField("Confirm")