Example #1
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)
class OrderForm(FlaskForm):
    customer_name = StringField('Name', validators=[DataRequired()])
    latitude = FloatField("Latitude", validators=[DataRequired()])
    longitude = FloatField("Longitude", validators=[DataRequired()])
    preferred_max_distance = IntegerField(
        "Preferred maximum distance (in kilometers)",
        validators=[DataRequired()])
    menu = FieldList(FormField(FoodQuantityForm), min_entries=1)
    submit = SubmitField('Submit')
Example #3
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 #4
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.'
                  ))
Example #5
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 #6
0
class EditEntryForm(FlaskForm):
    """ Edit a transaction / entry Form """
    id = HiddenField()
    game_session = IntegerField(
        label='Session',
        validators=[InputRequired('Please provide game session number.')])
    description = SearchField(
        label='Description',
        validators=[InputRequired('Please provide a name')])
    amount = FloatField(label='Amount',
                        validators=[InputRequired('Please enter an amount.')])
    submit = SubmitField('Save')
Example #7
0
class AddEntryForm(FlaskForm):
    """ Add Entry Form """
    game_session = IntegerField(
        label='Session',
        validators=[InputRequired('Please provide a game session number.')])
    description = SearchField(
        label='Description',
        validators=[InputRequired('Please provide a name')])
    amount = FloatField(
        label='Amount',
        validators=[InputRequired('Please provide an amount.')])
    submit = SubmitField('Save')
class KickstarterForm(FlaskForm):

    title = StringField("Title",
                        validators=[DataRequired(),
                                    Length(min=3, max=80)])
    photo_url = StringField("Photo Url", validators=[URL(), DataRequired()])
    video_url = StringField("Video Url", validators=[URL(), DataRequired()])
    end_date = StringField("End Date")
    money_goal = FloatField("Fundraising Goal")
    description = TextAreaField(
        "Description", validators=[DataRequired(),
                                   Length(min=3, max=10000)])
    submit = SubmitField("Submit")
Example #9
0
class ConfigurationForm(FlaskForm):
    leave_vidaxl_prefix = BooleanField(
        "Leave VidaXl prefix:",
        default=False,
    )
    category_rules_file = FileField("Category rule:")
    csv_url = StringField("XML Path:", default="")
    private_app_access_token = StringField("Access Token:", default="")
    mom_selector = BooleanField("Pricing by MoM:", default=False)
    margin_percent = FloatField("Margin percentage:", default=1.0)
    round_to = IntegerField("Define cents e.g. 50.xx:", default=99)
    categories_tree = HiddenField("Categories data")
    submit = SubmitField("Save")
class ItemsForm(FlaskForm):
    name = StringField("Item Name")
    add_item = SubmitField("Add New Item")
    update = SubmitField("Update Item Details")
    delete = SubmitField("Delete")
    order = SelectField('Sort by', choices = [("Oldest", "Oldest"), ("Newest", "Newest"), ("A-Z", "A-Z"), ("Z-A", "Z-A"), 
                                              ("Stock ↑", "Stock ↑"), ("Stock ↓", "Stock ↓"), ("Price ↑", "Price ↑"), 
                                              ("Price ↓", "Price ↓"), ("For Sale", "For Sale"), ("Not For Sale", "Not For Sale")])
    submit = SubmitField('Submit')
    back = SubmitField("Back")
    stock = IntegerField("Stock")
    price = FloatField("Price")
    for_sale = BooleanField("For Sale?")
    buy = SubmitField("Buy Item")
Example #11
0
class EventForm(Form):
    recaptcha = RecaptchaField("recaptcha")

    id = StringField('id')

    name = StringField('name', validators=[InputRequired(), Length(1, 300)])
    description = TextField('Description')

    fb_id = StringField('Facebook event id')
    fb_maybe_count = IntegerField('Facebook maybe count')
    fb_attending_count = IntegerField('Facebook attending count')

    # attending_count = db.Column(db.Integer, default=0)

    loc_id = StringField('Location id', validators=[InputRequired()])
    loc_name = StringField('Location name', validators=[InputRequired()])
    loc_city = StringField('City')
    loc_latitude = FloatField('Latitude', validators=[InputRequired()])
    loc_longitude = FloatField('Longitude', validators=[InputRequired()])
    loc_zip = StringField('Zip code')

    start_datetime = DateTimeField('Start time',
                                   format='%Y-%m-%dT%H:%M:%SZ',
                                   validators=[InputRequired()])
Example #12
0
class MovimientosForm(FlaskForm):
    fecha = DateField(
        "Fecha",
        validators=[
            DataRequired(message="Debe informar una fecha válida"),
            fecha_por_debajo_de_hoy
        ])
    concepto = StringField("Concepto",
                           validators=[DataRequired(),
                                       Length(min=10)])
    categoria = SelectField("Categoria",
                            choices=[("00", ""), ("SU", "Supervivencia"),
                                     ("OV", "Ocio/Vicio"), ("CU", "Cultura"),
                                     ("EX", "Extras")])
    cantidad = FloatField("Cantidad", validators=[DataRequired()])
    esGasto = BooleanField("Es gasto")
    submit = SubmitField("Aceptar")
Example #13
0
class MovimientosForm(FlaskForm):
    id = HiddenField()  #campo escondido
    fecha = DateField(
        "Fecha",
        validators=[
            DataRequired(message="Debe informar una fecha válida"),
            fecha_por_debajo_de_hoy
        ])
    concepto = StringField("Concepto",
                           validators=[DataRequired(),
                                       Length(min=10)])
    categoria = SelectField("Categoria",
                            choices=[('00', ''), ('SU', 'Supervivencia'),
                                     ('OV', 'Ocio/Vicio'), ('CU', 'Cultura'),
                                     ('EX', 'Extras')])
    cantidad = FloatField("Cantidad", validators=[DataRequired()])
    esGasto = BooleanField("Es gasto")
    submit = SubmitField('Aceptar')
Example #14
0
class MovimientosForm(FlaskForm):
    id = HiddenField()
    fecha = DateField(
        'Fecha',
        validators=[
            DataRequired(message='formato: aaaa-mm-dd'), fecha_hasta_hoy
        ]
    )  #ponemos la etiqueta que queremos que tenga el campo y validadores es una lista y va en corchete
    concepto = StringField('Concepto',
                           validators=[DataRequired(),
                                       Length(min=10)])
    categoria = SelectField('Categoria',
                            choices=[('00', ''), ('SU', 'Supervivencia'),
                                     ('OV', 'OCIO/VICIO'), ('CU', 'Cultura'),
                                     ('EX', 'Extras')])
    cantidad = FloatField("Cantidad", validators=[DataRequired()])
    esGasto = BooleanField("Es gasto")
    submit = SubmitField('Aceptar')
Example #15
0
class GroceryItemForm(FlaskForm):
    """Form for adding/updating a GroceryItem."""

    name = StringField("Name",
                       validators=[DataRequired(),
                                   Length(min=3, max=16)])
    price = FloatField("Price $",
                       validators=[DataRequired(),
                                   NumberRange(min=0)])
    category = SelectField("Category",
                           validators=[DataRequired()],
                           choices=ItemCategory.choices())
    photo_url = StringField("Photo URL", validators=[URL()])
    store = QuerySelectField("Store",
                             validators=[DataRequired()],
                             query_factory=lambda: GroceryStore.query)
    submit = SubmitField("Submit")

    def validate_name(self, name):
        if "dragonegg" in name.data.lower().replace(" ", ""):
            raise ValidationError("Dragon eggs are not allowed!")
Example #16
0
class SettingsForm(IndicoForm):
    debug = BooleanField(
        _('Debug mode'),
        widget=SwitchWidget(),
        description=_(
            "If enabled, requests are not sent to the API but logged instead"))
    service_url = URLField(
        _('Service URL'), [URL(require_tld=False)],
        description=_("The URL of the CERN calendar service"))
    username = StringField(
        _('Username'), [DataRequired()],
        description=_(
            "The username used to authenticate with the CERN calendar service")
    )
    password = IndicoPasswordField(
        _('Password'), [DataRequired()],
        toggle=True,
        description=_(
            "The password used to authenticate with the CERN calendar service")
    )
    status = SelectField(
        _('Status'), [DataRequired()],
        choices=_status_choices,
        description=_("The default status of the event in the calendar"))
    reminder = BooleanField(_('Reminder'),
                            description=_("Enable calendar reminder"))
    reminder_minutes = IntegerField(
        _('Reminder time'), [NumberRange(min=0)],
        description=_("Remind users X minutes before the event"))
    id_prefix = StringField(
        _('Prefix'),
        description=_(
            "Prefix for calendar item IDs. If you change this, existing calendar entries "
            "cannot be deleted/updated anymore!"))
    timeout = FloatField(_('Request timeout'), [NumberRange(min=0.25)],
                         description=_("Request timeout in seconds"))
    max_event_duration = TimeDeltaField(
        _('Maximum Duration'), [DataRequired()],
        units=('days', ),
        description=_('Events lasting longer will not be sent to Exchange'))
Example #17
0
class TargetWeightForm(FlaskForm):
    sex = RadioField(label='Gender',choices=[('m',"♂ Male"),('f',"♀ Female")],default='m')
    age = IntegerField("Age (years)",widget=TelInput())
    bw = FloatField("Body Weight (lb)",widget=TelInput())
    movement = SelectField(
        "Barbell Movement",
        choices=[
            ('01','Front Squat'),
            ('02','Back Squat'),
            ('03','Overhead Squat'),
            ('04','Clean (Squat Clean)'),
            ('05','Power Clean'),
            ('06','Clean & Jerk'),
            ('07','Deadlift'),
            ('08','Snatch (Squat Snatch)'),
            ('09','Power Snatch'),
            ('10','Strict Press'),
            ('11','Push Press'),
            ('12','Push Jerk'),
            ('13','Thruster'),
            ('14','Bench Press'),
            ]
    )
    submit = SubmitField("Calculate")
Example #18
0
class UpdateForm(FlaskForm):
    new_rating = FloatField("Your Rating out of 10",
                            validators=[DataRequired()])
    new_review = StringField("Your Review", validators=[DataRequired()])
    submit = SubmitField("Submit")
Example #19
0
class AddGradeInput(Form):
    assignment_id = StringField(InputRequired())
    grade_component_id = StringField(InputRequired())
    points = FloatField(InputRequired())
Example #20
0
class GradeForm(FlaskForm):
    grade = FloatField(
        "Pon la nota aquí",
        validators=[NumberRange(min=0, max=10, message='Invalid length')])
    submit = SubmitField("Enviar")
Example #21
0
class CreateGradeComponentInput(Form):
    id = StringField(validators=[Length(max=36), InputRequired()])
    description = StringField(validators=[InputRequired()])
    points = FloatField(validators=[InputRequired()])
Example #22
0
class MovieForm(FlaskForm):
    rating = FloatField('Your Rating Out of 10 e.g. 7.5')
    review = StringField('Your Review')
    submit = SubmitField('Done')
Example #23
0
class PConceptoForm(FlaskForm):
    id_cuenta = SelectField('Cuenta',
                            choices=[],
                            render_kw={'class': 'custom-select'})
    valor_parcial = FloatField('Parcial')
    cargo_abono = BooleanField('Cargo-Abono')
Example #24
0
class PlantEditStock(FlaskForm):
    medicine = StringField("id of medicine to edit", validators=[Required()]) #ought to be a dropdown or validated
    quantity = IntegerField("How many?", validators= [Required()])
    unit_price = FloatField("What price should it be?", validators=[Required()])
    submit = SubmitField("Confirm")
Example #25
0
class LifterProfileForm(FlaskForm):
    sex = RadioField(label="Gender",choices=[('m',"♂ Male"),('f',"♀ Female")])
    name = StringField("Name")
    age = IntegerField("Age (years)",widget=TelInput())
    bw = FloatField("Body Weight (lb)",widget=TelInput())
    submit = SubmitField("Save Profile")
Example #26
0
class BookForm(FlaskForm):
    book_name = StringField('Book Name', validators=[DataRequired()])
    author = StringField("Author",
                         validators=[DataRequired()])
    rating = FloatField("Rating", validators=[DataRequired()])
    submit = SubmitField('Submit')