Example #1
0
class ProjectSettingsForm(Form):
    min_version = IntegerField('Minimum library version:',
                               [validators.Optional()])
    min_client_version = IntegerField('Minimum pipeline version:',
                                      [validators.Optional()])
    alphabet = StringField('Alphabet:', [validators.InputRequired()])
    url_template = StringField('URL template:', [
        validators.InputRequired(),
        validators.Regexp(
            '^https?://.+{shortcode}',
            message='Template does not look like a URL template.'),
    ])
    request_delay = FloatField('Time between requests (seconds)',
                               [validators.InputRequired()])
    method = RadioField('HTTP method (get/head):',
                        [validators.InputRequired()],
                        choices=[('head', 'head'), ('get', 'get')])
    redirect_codes = NumListField('Redirect status codes:',
                                  [validators.InputRequired()])
    no_redirect_codes = NumListField('No redirect status codes:',
                                     [validators.InputRequired()])
    unavailable_codes = NumListField('Unavailable status codes:', )
    banned_codes = NumListField('Banned status codes:', )
    body_regex = StringField('Content body regular expression:')
    location_anti_regex = StringField(
        'Location header reject regular expression:')
Example #2
0
class SettingsForm(IndicoForm):
    admin_principals = PrincipalListField(_('Administrators'), groups=True)
    authorized_principals = PrincipalListField(_('Authorized users/groups'),
                                               groups=True)
    excluded_categories = MultipleItemsField(
        _('Excluded categories'),
        fields=[{
            'id': 'id',
            'caption': 'Category ID'
        }],
        description=_(
            'Disable quick-book on event creation in these categories'))
    assistance_emails = EmailListField(
        _('Assistance email addresses (one per line)'))
    notification_before_days = IntegerField(
        _('Send booking reminders X days before (single/daily)'),
        [InputRequired(), NumberRange(min=1, max=30)])
    notification_before_days_weekly = IntegerField(
        _('Send booking reminders X days before (weekly)'),
        [InputRequired(), NumberRange(min=1, max=30)])
    notification_before_days_monthly = IntegerField(
        _('Send booking reminders X days before (monthly)'),
        [InputRequired(), NumberRange(min=1, max=30)])
    notifications_enabled = BooleanField(_('Reminders enabled'))
    vc_support_emails = EmailListField(
        _('Videoconference support email addresses (one per line)'))
    booking_limit = IntegerField(
        _('Maximum length of booking (days)'),
        [InputRequired(), NumberRange(min=1)])
    google_maps_api_key = StringField(_('Google Maps API key'),
                                      description=GOOGLE_API_KEY_DESC)
Example #3
0
class ProductForm(FlaskForm):
    productName = StringField('Product Name', validators=[DataRequired()])
    slug = StringField('Slug', validators=[DataRequired()])
    price = IntegerField('Price', validators=[DataRequired()])
    discount = IntegerField('Discount')
    stock = IntegerField('Stock', validators=[DataRequired()])
    category = SelectField('Category', choices=[], validators=[DataRequired()])
    brand = SelectField('Brand', choices=[])
    color = StringField('Color')
    size = StringField('Size')
    weight = StringField('Weight')
    dimension = StringField('Dimension')
    material = StringField('Material')
    shortDescription = TextAreaField('Short Description')
    longDescription = TextAreaField('Long Description')
    imageFile = FileField('Set Featured image',
                          validators=[FileAllowed(['jpg', 'png'])])
    imageGallery = FileField('Gallery',
                             validators=[FileAllowed(['jpg', 'png'])])
    featured = BooleanField("Featured")
    # product_user_id = current_user

    submit = SubmitField('Add Product')

    edit = SubmitField('Save Changes')
Example #4
0
class QueueSettingsForm(Form):
    autoqueue = BooleanField('AutoQueue')
    num_count_per_item = IntegerField('Number of URLs per item:')
    max_num_items = IntegerField('Maximum number of items in todo queue:')
    lower_sequence_num = IntegerField('Lower sequence number:',
                                      [validators.Optional()])
    autorelease_time = IntegerField('AutoRelease items after minutes:',
                                    [validators.Optional()])
Example #5
0
class SettingsForm(IndicoForm):
    admin_principals = PrincipalListField(_(u'Administrators'), groups=True)
    authorized_principals = PrincipalListField(_(u'Authorized users/groups'), groups=True)
    assistance_emails = EmailListField(_(u'Assistance email addresses (one per line)'))
    notification_hour = IntegerField(_(u'Hour at which booking reminders should be sent'),
                                     [InputRequired(), NumberRange(0, 23)])
    notification_before_days = IntegerField(_(u'Send booking reminders X days before'),
                                            [InputRequired(), NumberRange(min=1, max=9)])
    notifications_enabled = BooleanField(_(u'Reminders enabled'))
    vc_support_emails = EmailListField(_(u'Videoconference support email addresses (one per line)'))
Example #6
0
class ResultForm(FlaskForm):
    """Form to create the policy-target
    """
    policy = StringField(
        'Policy',
        render_kw={'placeholder': "Enter or select the type of intervention"},
        validators=[DataRequired()])
    target = StringField(
        'Target',
        render_kw={'placeholder': "Enter or select the target measure"},
        validators=[DataRequired()])
    policyUnit = StringField(
        'Policy unit',
        render_kw={
            'placeholder': "Enter or select the policy unit of measurement"
        },
        validators=[DataRequired()])
    targetUnit = StringField(
        'Target unit',
        render_kw={
            'placeholder': "Enter or select the target unit of measurement"
        },
        validators=[DataRequired()])
    method = StringField('Identification Method',
                         render_kw={
                             'placeholder':
                             "Enter or select the identification strategy"
                         },
                         validators=[DataRequired()])
    country = StringField(
        'Program Country',
        render_kw={
            'placeholder': "Select the country in which the program took place"
        },
        validators=[DataRequired()])
    year = IntegerField(
        'Program Year',
        render_kw={'placeholder': "Select the year the program took place"},
        validators=[DataRequired()])
    estimate = FloatField(
        'Estimate',
        render_kw={
            'placeholder':
            "Copy the causal effect of the policy on the target from article"
        },
        validators=[DataRequired()])
    standardError = FloatField(
        'Standard-Error',
        render_kw={'placeholder': "Copy the associated standard-error"},
        validators=[DataRequired()])

    sampleSize = IntegerField(
        'Sample Size',
        render_kw={'placeholder': "Copy the sample size"},
        validators=[DataRequired()])
Example #7
0
class FormMenu(DefaultForm):
    address = TextField(localize("administration", "menus.field_address"),
                        validators=[DataRequired()])
    name = TextField(localize("administration", "menus.field_name"))
    menubar = TextField(localize("administration", "menus.field_menubar"),
                        validators=[DataRequired()])
    weight = IntegerField(localize("administration", "menus.field_weight"),
                          validators=[DataRequired()])
    flags = IntegerField(localize("administration", "menus.field_flags"),
                         validators=[NumberRange(0, 10)])
    image = TextField(localize("administration", "menus.field_image"))
Example #8
0
class ContactForm(FlaskForm):
    name = StringField("Full Name", validators=[DataRequired()])
    Age = IntegerField("Age", validators=[DataRequired()])
    Gender = SelectField('Gender', choices=[('M', 'Male'), ('F', 'Female')])
    email = StringField("Email", validators=[DataRequired()])
    mobno = IntegerField("Mob No", validators=[DataRequired()])
    language = SelectField('Languages',
                           choices=[('c', 'C'), ('cpp', 'C++'),
                                    ('py', 'Python'), ('java', 'Java')])
    query = TextAreaField("Query", validators=[DataRequired()])
    submit = SubmitField("SUBMIT")
Example #9
0
class RoomForm(IndicoForm):
    name = StringField(_(u'Name'))
    site = StringField(_(u'Site'))
    building = StringField(_(u'Building'), [DataRequired()])
    floor = StringField(_(u'Floor'), [DataRequired()])
    number = StringField(_(u'Number'), [DataRequired()])
    longitude = FloatField(_(u'Longitude'), [Optional()])
    latitude = FloatField(_(u'Latitude'), [Optional()])
    is_active = BooleanField(_(u'Active'), default=True)
    is_reservable = BooleanField(_(u'Public'), default=True)
    reservations_need_confirmation = BooleanField(_(u'Confirmations'))
    notification_for_assistance = BooleanField(_(u'Assistance'))
    notification_before_days = IntegerField(
        _(u'Notification on booking start - X days before'),
        [Optional(), NumberRange(min=0, max=9)],
        default=0)
    notification_for_responsible = BooleanField(
        _(u'Notification to responsible, too'))
    owner_id = HiddenField(_(u'Responsible user'), [DataRequired()])
    key_location = StringField(_(u'Where is key?'))
    telephone = StringField(_(u'Telephone'))
    capacity = IntegerField(
        _(u'Capacity'), [DataRequired(), NumberRange(min=1)], default=20)
    division = StringField(_(u'Department'))
    surface_area = IntegerField(_(u'Surface area'),
                                [Optional(), NumberRange(min=0)])
    max_advance_days = IntegerField(
        _(u'Maximum advance time for bookings'),
        [Optional(), NumberRange(min=1)])
    comments = TextAreaField(_(u'Comments'))
    delete_photos = BooleanField(_(u'Delete photos'))
    large_photo = FileField(_(u'Large photo'))
    small_photo = FileField(_(u'Small photo'))
    available_equipment = IndicoQuerySelectMultipleCheckboxField(
        _(u'Equipment'),
        get_label=_get_equipment_label,
        modify_object_list=_group_equipment)
    # attribute_* - set at runtime
    bookable_hours = FieldList(FormField(_TimePair), min_entries=1)
    nonbookable_periods = FieldList(FormField(_DateTimePair), min_entries=1)

    def validate_large_photo(self, field):
        if not field.data and self.small_photo.data:
            raise ValidationError(
                _(u'When uploading a small photo you need to upload a large photo, too.'
                  ))

    def validate_small_photo(self, field):
        if not field.data and self.large_photo.data:
            raise ValidationError(
                _(u'When uploading a large photo you need to upload a small photo, too.'
                  ))
class createClassForm(FlaskForm):
    subject = SelectField('Select Subject', choices=[(g.id, g.name) for g in Subject.query.all()])
    name = StringField('Class Name', validators=[DataRequired()])
    seats = IntegerField('Seat Number', validators=[DataRequired()])
    lesson = IntegerField('Lesson Number', validators=[DataRequired()])
    lesson_start = IntegerField('Lesson Start', validators=[DataRequired()])
    # date_start = DateField('Date Start', validators=[DataRequired()], format='%d-%m-%Y')
    # date_end = DateField('Date End', validators=[DataRequired()], format='%d-%m-%Y')
    submit = SubmitField('Add to Class')




        
Example #11
0
class addBook(FlaskForm):
    title = StringField(
        "Book Title",
        validators=[
            InputRequired("Enter a Valid Title"),
            Length(max=255, message="Title Should be less than 255 charecters")
        ])
    author = TextField("Authors",
                       validators=[InputRequired("Enter a Valid Title")])
    price = IntegerField("Price",
                         validators=[InputRequired("Enter a Valid Price")])
    stock = IntegerField(
        "Available Stock",
        validators=[InputRequired("Enter the number of books available")])
    submit = SubmitField("Add Book")
Example #12
0
class ArticleForm(FlaskForm):
    """Form to create the article in the database

    """
    title = StringField('Article Title',
                        render_kw={'placeholder': "Enter the article title"},
                        validators=[DataRequired()])

    link = StringField(
        'Article link',
        render_kw={'placeholder': "Enter the article link"},
        validators=[DataRequired(),
                    URL(message='Must be a valid URL')])

    year = IntegerField(
        'Publication Year',
        render_kw={'placeholder': "Enter the publication year of the article"},
        validators=[DataRequired()])

    journal = StringField('Journal',
                          render_kw={
                              'placeholder':
                              "Journal in which the article was published"
                          },
                          validators=[DataRequired()])
    authors = FieldList(FormField(AuthorForm), min_entries=1, max_entries=20)
    submit = SubmitField('Save General Informations')
Example #13
0
class AdminSettingsForm(IndicoForm):
    currencies = MultipleItemsField(
        _('Currencies'), [DataRequired()],
        fields=(('code', _('Code')), ('name', _('Name'))),
        unique_field='code',
        description=
        _("List of currencies that can be selected for an event. When deleting "
          "a currency, existing events will keep using it. The currency code "
          "must be a valid <a href='{0}'>ISO-4217</a> code such "
          "as 'EUR' or 'CHF'.").format(CURRENCY_CODE_LINK))
    currency = SelectField(
        _('Currency'), [DataRequired()],
        description=_(
            'The default currency for new events. If you add a new currency, you need to '
            'save the settings first for it to show up here.'))
    conditions = TextAreaField(_('Conditions'), description=CONDITIONS_DESC)
    checkout_session_timeout = IntegerField(
        'Checkout session timeout',
        validators=[DataRequired(), NumberRange(min=0)],
        description=CHECKOUT_SESSION_TIMEOUT_MSG)

    def __init__(self, *args, **kwargs):
        super(AdminSettingsForm, self).__init__(*args, **kwargs)
        self._set_currencies()

    def _set_currencies(self):
        currencies = [(c['code'], '{0[code]} ({0[name]})'.format(c))
                      for c in settings.get('currencies')]
        self.currency.choices = sorted(currencies, key=lambda x: x[1].lower())

    def validate_currency(self, field):
        if field.data not in {c['code'] for c in self.currencies.data}:
            raise ValidationError('Please select a different currency.')
Example #14
0
class SearchRoomsForm(IndicoForm):
    location = QuerySelectField(_(u'Location'),
                                get_label=lambda x: x.name,
                                query_factory=Location.find,
                                allow_blank=True)
    details = StringField()
    capacity = IntegerField(_(u'Capacity'),
                            validators=[Optional(),
                                        NumberRange(min=0)])
    available_equipment = IndicoQuerySelectMultipleCheckboxField(
        _(u'Equipment'),
        get_label=u'name',
        query_factory=lambda: EquipmentType.find().order_by(EquipmentType.name
                                                            ))
    is_only_public = BooleanField(_(u'Only public rooms'), default=True)
    is_auto_confirm = BooleanField(_(u'Only rooms not requiring confirmation'),
                                   default=True)
    is_only_active = BooleanField(_(u'Only active rooms'), default=True)
    is_only_my_rooms = BooleanField(_(u'Only my rooms'))
    repeatability = StringField(
    )  # TODO: use repeat_frequency/interval with new UI
    include_pending_blockings = BooleanField(
        _(u'Check conflicts against pending blockings'), default=True)
    include_pre_bookings = BooleanField(
        _(u'Check conflicts against pre-bookings'), default=True)
Example #15
0
class NewReceptionist(FlaskForm):
    name = StringField('Receptionist Name',
                       validators=[DataRequired(),
                                   Length(min=2, max=20)])
    email = StringField('Receptionist Email',
                        validators=[DataRequired(), Email()])
    ssn = StringField('Receptionist SSN', validators=[DataRequired()])
    dob = DateField('Receptionist Birthday', validators=[DataRequired()])
    salary = IntegerField('Receptionist Salary', validators=[DataRequired()])
    gender = StringField('Receptionist Gender',
                         validators=[DataRequired(),
                                     Length(min=4, max=6)])
    address = StringField('Receptionist Address',
                          validators=[DataRequired(),
                                      Length(min=3, max=100)])
    submit = SubmitField('Add New Reciptionist')

    def validate_ssn(self, ssn):
        ssn = Receptionist.query.filter_by(ssn=ssn.data).first()
        if ssn:
            raise ValidationError("This ssn already exists")

    def validate_email(self, email):
        email = Receptionist.query.filter_by(email=email.data).first()
        if email:
            raise ValidationError(
                "This Email already exists. try a different one")
Example #16
0
class RunForm(FlaskForm):
    id_org = SelectField('Organization', [DataRequired()], choices=[("actc", "ACTC"), ("apat", "APAT"), ("aptp", "APTP"), (
        "auvo", "AUVO"), ("carx", "CARX"), ("cur", "CUR"), ("gpu", "GPU"), ("mss", "MSS"), ("tc", "TC"), ("tr", "TR")])
    year = IntegerField('Year')
    manual = BooleanField('Manual')
    org = HiddenField('org')
    submit = SubmitField('create')
Example #17
0
class UpdateAccountInfoForm(FlaskForm):
    username = StringField(
        "Name",
        validators=[
            DataRequired(),
            Length(min=3,
                   max=50,
                   message="Name must be 3 to 50 characters long"),
        ],
    )
    email = StringField("E-mail", validators=[DataRequired(), Email()])
    contact = IntegerField(
        "Contact",
        validators=[
            DataRequired(),
            NumberRange(
                min=1000000000,
                max=9999999999,
                message="Contact number should have 10 digits (no spaces)",
            ),
        ],
        render_kw={
            "inputmode": "numeric",
            "minlength": "10",
            "maxlength": "10"
        },
    )
    password = PasswordField("Password *", validators=[DataRequired()])
    submitInfo = SubmitField("Save Changes")

    def validate_password(self, password):
        if not encryptor.check_password_hash(current_user.password,
                                             password.data):
            raise ValidationError("Incorrect Password")
Example #18
0
class NewBookingFormBase(IndicoForm):
    start_dt = DateTimeField('Start date', validators=[InputRequired()], parse_kwargs={'dayfirst': True},
                             display_format='%d/%m/%Y %H:%M')
    end_dt = DateTimeField('End date', validators=[InputRequired()], parse_kwargs={'dayfirst': True},
                           display_format='%d/%m/%Y %H:%M')
    repeat_frequency = RadioField('Repeat frequency', coerce=int, default=0, validators=[InputRequired()],
                                  choices=[(0, _('Once')), (1, _('Daily')), (2, _('Weekly')), (3, _('Monthly'))])
    repeat_interval = IntegerField('Repeat interval', validators=[NumberRange(0, 3)], default=0)

    def validate_repeat_interval(self, field):
        if (self.repeat_frequency.data, self.repeat_interval.data) not in RepeatMapping.mapping:
            raise ValidationError('Invalid repeat step')

    def validate_start_dt(self, field):
        if field.data != field.object_data and field.data.date() < date.today() and not session.user.is_admin:
            raise ValidationError(_('The start time cannot be in the past.'))

    def validate_end_dt(self, field):
        start_dt = self.start_dt.data
        end_dt = self.end_dt.data
        if start_dt.time() >= end_dt.time():
            raise ValidationError('Invalid times')
        if self.repeat_frequency.data == RepeatFrequency.NEVER:
            field.data = datetime.combine(start_dt.date(), field.data.time())
        elif start_dt.date() >= end_dt.date():
            raise ValidationError('Invalid period')
Example #19
0
class SettingsForm(IndicoForm):
    admin_principals = PrincipalField(_(u'Administrators'), groups=True)
    authorized_principals = PrincipalField(_(u'Authorized users/groups'),
                                           groups=True)
    assistance_emails = EmailListField(
        _(u'Assistance email addresses (one per line)'))
    notification_hour = IntegerField(
        _(u'Hour at which occurrence notifications should be sent'),
        [InputRequired(), NumberRange(0, 23)],
        default=6)
    notification_before_days = IntegerField(
        _(u'Send occurrence notifications X days before the occurrence'),
        [InputRequired()],
        default=0)
    vc_support_emails = EmailListField(
        _(u'Videoconference support email addresses (one per line)'))
Example #20
0
class CameraForm(BaseModelForm):
    state = SelectField(coerce=int,
                        label=gettext("State"),
                        choices=get_enum_states(),
                        default=0)
    state_notes = StringField(gettext("State notes"), [Length(max=255)])

    manufacturer = StringField(
        gettext("Manufacturer (required)"),
        [DataRequired(), Length(max=255)])
    model = StringField(gettext("Model (required)"),
                        [DataRequired(), Length(max=255)])
    model_notes = TextAreaField(gettext("Model notes"))
    description = TextAreaField(gettext("Description"))
    serial = StringField(gettext("Serial number (stay private)"),
                         [Length(max=255)])
    mount = StringField(gettext("Mount"), [Length(max=255)])

    camera_type = SelectField(coerce=int,
                              label=gettext("Camera Type"),
                              choices=get_enum_cameras_types(),
                              default=0)

    film_type = SelectField(coerce=int,
                            label=gettext("Film Type"),
                            choices=get_enum_film_types(),
                            default=0)
    auto_expo = BooleanField(gettext("Auto exposure"))
    auto_focus = BooleanField(gettext("Auto focus"))
    batteries = StringField(gettext("Batteries type"))
    hot_shoe = BooleanField(gettext("Hot Shoe"))
    fixed_lens = BooleanField(gettext("Fixed lens"))

    iso_min = IntegerField(gettext("ISO Min"), default=0)
    iso_max = IntegerField(gettext("ISO Max"), default=0)
    focale_min = IntegerField(gettext("Focale min"), default=0)
    focale_max = IntegerField(gettext("Focale max"), default=0)
    min_aperture = FloatField(gettext("Min Aperture"), default=0)
    max_aperture = FloatField(gettext("Max Aperture"), default=0)
    blades = BooleanField(gettext("Using blades"))
    filter_diameter = IntegerField(gettext("Filter Dia. (mm)"), default=0)
    focus = SelectField(coerce=int,
                        label=gettext("Focus Mode"),
                        choices=get_enum_focuses_types(),
                        default=0)
    focus_length = IntegerField(gettext("Min focus (cm)"), default=0)
    macro = BooleanField(gettext("Macro capable"))
    macro_length = IntegerField(gettext("Min macro (cm)"), default=0)
    weight = IntegerField(gettext("Weight (g)"), default=0)
    length = FloatField(gettext("Length (cm)"), default=0)
    picture = FileField("Image", [FileAllowed(pictures, "Images only!")])

    private = BooleanField(gettext("Keep this private"))

    url1 = StringField(gettext("URL 1"), [Length(max=255)])
    url2 = StringField(gettext("URL 2"), [Length(max=255)])
    url3 = StringField(gettext("URL 3"), [Length(max=255)])
Example #21
0
class BookForm(FlaskForm):
    title = StringField('Название', validators=[DataRequired()])
    author = StringField('Автор', validators=[DataRequired()])
    link = StringField('Ссылка на Яндекс.Диск', default='')
    info = TextAreaField('Краткое описание книги')
    img = StringField('Картинка', validators=[DataRequired()])
    year = IntegerField('Год написания', validators=[DataRequired()])
    submit = SubmitField('Сохранить')
Example #22
0
class AddressForm(FlaskForm):
    name = StringField('Name', [validators.Length(min=4, max=25)])
    address = TextAreaField('Address', [InputRequired()])
    city = StringField('City', [InputRequired()])
    state = StringField('State', [InputRequired()])
    country = StringField('Country', [InputRequired()])
    pincode = IntegerField('Pincode',
                           validators=[
                               NumberRange(message="Should be a number"),
                               InputRequired()
                           ])
    phonenum = IntegerField('Phone Number', validators=[InputRequired()])
    email = StringField(
        'Email Address',
        validators=[Email(message="Input valid email"),
                    InputRequired()])
    submit = SubmitField('Add to address book')
Example #23
0
class Acceso(Form):
    lc_ordn = StringField(
        labels.lbl_ordn, [validators.DataRequired(message=errors.ERR_NO_ORDN)])
    lc_dscrpcn = StringField(
        labels.lbl_prgnta,
        [validators.DataRequired(message=errors.ERR_NO_Dscrpcn)])
    ln_id_mnu = IntegerField(labels.lbl_id_mnu)
    lc_lnk = StringField(labels.lbl_lnk)
Example #24
0
class BasicForm(FlaskForm):
    first_name = StringField('First Name')
    last_name = StringField('Last Name')
    date = DateField('Date')
    age = IntegerField('Age')
    gender = SelectField(
        'Gender', choices=['male', 'female', 'other', 'prefer not to say'])
    submit = SubmitField('Add Name')
Example #25
0
class RoomForm(IndicoForm):
    name = StringField(_(u'Name'))
    site = StringField(_(u'Site'))
    building = StringField(_(u'Building'), [DataRequired()])
    floor = StringField(_(u'Floor'), [DataRequired()])
    number = StringField(_(u'Number'), [DataRequired()])
    longitude = FloatField(_(u'Longitude'), [Optional()])
    latitude = FloatField(_(u'Latitude'), [Optional()])
    is_active = BooleanField(_(u'Active'), default=True)
    is_reservable = BooleanField(_(u'Public'), default=True)
    reservations_need_confirmation = BooleanField(_(u'Confirmations'))
    notification_for_assistance = BooleanField(_(u'Assistance'))
    notification_before_days = IntegerField(_(u'Send booking reminders X days before (single/daily)'),
                                            [Optional(), NumberRange(min=1, max=30)])
    notification_before_days_weekly = IntegerField(_(u'Send booking reminders X days before (weekly)'),
                                                   [Optional(), NumberRange(min=1, max=30)])
    notification_before_days_monthly = IntegerField(_(u'Send booking reminders X days before (monthly)'),
                                                    [Optional(), NumberRange(min=1, max=30)])
    notifications_enabled = BooleanField(_(u'Reminders enabled'), default=True)
    booking_limit_days = IntegerField(_(u'Maximum length of booking (days)'), [Optional(), NumberRange(min=1)])
    owner = PrincipalField(_(u'Owner'), [DataRequired()], allow_external=True)
    key_location = StringField(_(u'Where is key?'))
    telephone = StringField(_(u'Telephone'))
    capacity = IntegerField(_(u'Capacity'), [Optional(), NumberRange(min=1)], default=20)
    division = StringField(_(u'Department'))
    surface_area = IntegerField(_(u'Surface area'), [Optional(), NumberRange(min=0)])
    max_advance_days = IntegerField(_(u'Maximum advance time for bookings'), [Optional(), NumberRange(min=1)])
    comments = TextAreaField(_(u'Comments'))
    delete_photos = BooleanField(_(u'Delete photos'))
    large_photo = FileField(_(u'Large photo'))
    available_equipment = IndicoQuerySelectMultipleCheckboxField(_(u'Equipment'), get_label=_get_equipment_label,
                                                                 modify_object_list=_group_equipment)
    # attribute_* - set at runtime
    bookable_hours = FieldList(FormField(_TimePair), min_entries=1)
    nonbookable_periods = FieldList(FormField(_DateTimePair), min_entries=1)
Example #26
0
class ChallengeForm(Form):
    title = StringField("Title", [validators.Length(min=4, max=25)])
    content = TextAreaField("Content")
    flag_or_answer = StringField("Flag/Answer")
    is_flag = BooleanField("Is Flag")
    tags = TagListField("Tags")
    hidden = BooleanField("Hidden")
    depreciated = BooleanField("Depreciated")
    points = IntegerField("Points", [validators.NumberRange(min=1)])
Example #27
0
class BookForm(FlaskForm):
    universe = QuerySelectField('Universe', query_factory=universe_choices, get_label='title', allow_blank=True)
    series = QuerySelectField('Series', query_factory=series_choices, get_label='title', allow_blank=True)
    author = QuerySelectField('Author', query_factory=author_choices, get_label='full_name', allow_blank=True)
    coauthor = QuerySelectField('Co-Author', query_factory=author_choices, get_label='full_name', allow_blank=True)
    title = StringField('Title', validators=[DataRequired()])
    series_number = IntegerField('Series Number', validators=[Optional()])
    submit = SubmitField('Submit')
    delete = SubmitField('Delete')
Example #28
0
class EditProfileForm(FlaskForm):
    """Edit Profile Form"""

    username = StringField('Confirm/Change Username')
    age = IntegerField("Age")
    password = PasswordField('Confirm/Change Password',
                             validators=[Length(min=6) or None])
    email = StringField('Confirm/Change Email')
    image_url = StringField('Please include valid image link')
Example #29
0
class User(db.Document, UserMixen):
    id = IntegerField(primary_key=True)
    username = StringField(unique=True)
    email = EmailField(unique=True)
    image_file = StringField(default='default.jpg')
    password = StringField(default=True)
    isAdmin = BooleanField(default=False)
    posts = Relationship('Post', backref='author', lazy=True)

    def __repr__(self):
        return f"User('{self.username}', '{self.email}', '{self.image_file}')"
Example #30
0
class TransactionForm(FlaskForm):
    ticker = StringField('ticker', validators=[DataRequired()])
    price = DecimalField('price',
                         places=2,
                         rounding=decimal.ROUND_UP,
                         validators=[DataRequired()])
    amount = IntegerField('shares', validators=[DataRequired()])
    company = StringField('company', validators=[DataRequired()])
    buy_or_sell = SelectField(u'Buy or Sell',
                              choices=[('BUY', 'Buy'), ('SELL', 'Sell')])
    submit = SubmitField('Submit')