Esempio n. 1
0
class RoomForm(fossirForm):
    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'))
    small_photo = FileField(_(u'Small photo'))
    available_equipment = fossirQuerySelectMultipleCheckboxField(
        _(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.'
                  ))
Esempio n. 2
0
class JournalEntryForm(FlaskForm):
    SourceAccountNumber = StringField(
        'Source Account',
        validators=[DataRequired('field is required.')],
        render_kw={"placeholder": "12345678"})
    DestAccountNumber = StringField(
        'Destination Account',
        validators=[DataRequired('field is required.')],
        render_kw={"placeholder": "87654321"})
    Debits = StringField('Debits (separated by commas)',
                         validators=[DataRequired('field is required.')],
                         render_kw={"placeholder": "1.00, 2.00, etc."})
    Credits = StringField('Credits (separated by commas)',
                          validators=[DataRequired('field is required.')],
                          render_kw={"placeholder": "1.00, 2.00, etc."})
    Comment = StringField('Comment',
                          render_kw={"placeholder": "optional comment"})
    TypeOfAcc = SelectField('Type of Transaction',
                            choices=[
                                ('Expense or Revenue', 'Expense or Revenue'),
                                ('Other', 'Other')
                            ],
                            validators=[DataRequired('field is required.')])
    File = FileField('File', validators=None)
    Submit = SubmitField('Submit')
Esempio n. 3
0
class InformacionGeneral(FlaskForm):
    nombreReceta = StringField(
                    'Nombre de la receta', 
                    validators=[
                        DataRequired(), 
                        Length(min=2, max=50)
                    ]
                )
    tiempoPreparacion = IntegerField(
                            'Tiempo de preparación', 
                            validators=[
                                DataRequired()
                            ]
                        )
    dificultad = SelectField(
                    'Dificultad',
                    choices=[], 
                    coerce=int
                )
    imagenReceta = FileField('Imagen de la receta')
    nombreImagen = StringField(
                    'Nombre de la imagen', 
                    validators=[
                        DataRequired(), 
                        Length(min=2, max=20)
                    ]
                )
    submit = SubmitField('Siguiente')
Esempio n. 4
0
class FormNoticia(FlaskForm):
    id = HiddenField(validators=[Optional()])
    categoria = SelectField(
        "Categoria",
        choices=[
            ("Geral", "Geral"),
            ("Segurança", "Segurança"),
            ("Saúde", "Saúde"),
            ("Economia", "Economia"),
        ],
        default="Geral",
    )

    titulo = StringField(
        "Título",
        [
            DataRequired(message="Informe título da notícia."),
            Length(5, 150, message="Deve ter pelo menos 5 caracteres."),
        ],
    )

    conteudo = TextAreaField("Conteúdo")

    destaque = SelectField(
        "Destacar na página inicial?",
        choices=[("sim", "Sim"), ("nao", "Não")],
        default="nao",
    )

    thumb = FileField("Imagem de capa da notícia", validators=[Optional()])
Esempio n. 5
0
class UploadForm(FlaskForm):
    description = TextAreaField('Description', validators=[InputRequired()])
    photo = FileField('Photo',
                      validators=[
                          FileRequired(),
                          FileAllowed(['jpg', 'jpeg', 'png'], 'Images only!')
                      ])
Esempio n. 6
0
class StoreForm(AddressAccountForm):
    name = StringField("Name",
                       validators=[
                           InputRequired(),
                           Length(2, 25, "Name does not respect our rules.")
                       ])
    picture = FileField("Select a picture...")
    edit_button = SubmitField("Edit")
    add_button = SubmitField("Add")
Esempio n. 7
0
class APTReconstructionForm(Form):
    """Form to describe metadata for a APT reconstruction"""

    title = StringField('Title', description='Title for this reconstruction')
    description = TextAreaField(
        'Description',
        description='Longer-form description of this reconstruction')
    reconstruction_method = RadioField(
        'Reconstruction Method',
        description='Method used to reconstruct APT data',
        choices=[('shank_angle', 'Shank Angle'),
                 ('voltage_profile', 'Voltage Profile'),
                 ('tip_image', 'Tip Image')],
        default='shank_angle')
    tip_radius = FloatField('Initial Tip Radius',
                            description='Initial tip radius (nm)',
                            render_kw={'min': 0},
                            validators=[Optional()])
    evaporation_field = FloatField(
        'Evaporation field',
        description='Evaporation field strength (V/nm)',
        validators=[Optional()])
    initial_voltage = FloatField('Initial voltage',
                                 description='Initial voltage (V)',
                                 validators=[Optional()])
    shank_angle = FloatField('Shank Angle',
                             description='Shank angle (degrees)',
                             render_kw={'min': 0},
                             validators=[Optional()])
    tip_image = FileField('Tip Image', description='SEM image of tip')
    metadata = FieldList(
        FormField(KeyValueForm),
        'Reconstruction Metadata',
        description=
        'Structured metadata about reconstruction. Use to make indexing easier'
    )
    pos_file = FileField('POS File', render_kw={'accept': '.pos,.POS'})
    rrng_file = FileField('RRNG File', render_kw={'accept': '.rrng,.RRNG'})
Esempio n. 8
0
class FormDocumento(FlaskForm):
    id = HiddenField(validators=[Optional()])
    titulo = StringField("Título do documento", validators=[DataRequired()])
    tipo = SelectField(
        "Tipo de documento",
        choices=[
            ("Lei", "Lei"),
            ("Projeto de lei", "Projeto de lei"),
            ("Decreto", "Decreto"),
        ],
        default="Lei",
    )
    arquivo = FileField("Documento", validators=[Optional()])
    palavras_chave = StringField("Palavras de busca", validators=[DataRequired()])
Esempio n. 9
0
class MediCalRequestForm(FlaskForm):
    memberid = StringField('Member ID', validators=[Optional()])
    name = StringField('Template Name', validators=[Optional()])
    case_name = StringField('Case Name', validators=[Optional()])
    frequency = StringField('Frequency', validators=[Optional()])
    referring = StringField('Referring MD', validators=[Optional()])
    icd10_1 = StringField('ICD10', validators=[Optional()])
    icd10_2 = StringField('ICD10', validators=[Optional()])
    icd10_3 = StringField('ICD10', validators=[Optional()])
    icd10_4 = StringField('ICD10', validators=[Optional()])
    icd10_5 = StringField('ICD10', validators=[Optional()])
    icd10_6 = StringField('ICD10', validators=[Optional()])
    icd10_7 = StringField('ICD10', validators=[Optional()])
    cpt_1 = StringField('CPT', validators=[Optional()])
    cpt_2 = StringField('CPT', validators=[Optional()])
    cpt_3 = StringField('CPT', validators=[Optional()])
    cpt_4 = StringField('CPT', validators=[Optional()])
    cpt_5 = StringField('CPT', validators=[Optional()])
    cpt_6 = StringField('CPT', validators=[Optional()])
    cpt_7 = StringField('CPT', validators=[Optional()])
    unit_1 = IntegerField('Unit', validators=[Optional()])
    unit_2 = IntegerField('Unit', validators=[Optional()])
    unit_3 = IntegerField('Unit', validators=[Optional()])
    unit_4 = IntegerField('Unit', validators=[Optional()])
    unit_5 = IntegerField('Unit', validators=[Optional()])
    unit_6 = IntegerField('Unit', validators=[Optional()])
    unit_7 = IntegerField('Unit', validators=[Optional()])
    dob = DateField('DOB', format='%m/%d/%Y', validators=[Optional()])
    start_date = DateField('Start Date',
                           format='%m/%d/%Y',
                           validators=[Optional()])
    end_date = DateField('End Date',
                         format='%m/%d/%Y',
                         validators=[Optional()])
    prescription_date = DateField('Prescription Date',
                                  format='%m/%d/%Y',
                                  validators=[Optional()])
    onset_date = DateField('Onset Date',
                           format='%m/%d/%Y',
                           validators=[Optional()])
    file = FileField('File')
    message = StringField('Message', validators=[Optional()])
    medical_justification = StringField('Medical Justification',
                                        validators=[Optional()])
    urgent = BooleanField('Urgent', validators=[Optional()])
    emr = BooleanField('EMR', validators=[Optional()])
    gender = SelectField('Gender', choices=[('M', 'Male'), ('F', 'Female')])
    submit = SubmitField('Add Member')
Esempio n. 10
0
class NuevoIngrediente(FlaskForm):
    nombreIngrediente = StringField(
                            'Nombre del ingrediente', 
                            validators=[
                                DataRequired(), 
                                Length(min=2, max=50)
                            ]
                        )
    unidad = SelectField(
                'Unidad',
                choices=[], 
                coerce=int
            )
    imagenIngrediente = FileField('Imagen del ingrediente')
    nombreImagen = StringField(
                    'Nombre de la imagen', 
                    validators=[
                        DataRequired(), 
                        Length(min=2, max=20)
                    ]
                )
    submit = SubmitField('Agregar')
Esempio n. 11
0
class APTSampleForm(Form):
    """Form to get data for a new sample"""

    sample_name = StringField(
        'Sample Name',
        description='Name of sample directory. Cannot contain whitespace.',
        render_kw=dict(
            pattern='\\w+',
            title='Only word characters allowed: A-Z, a-z, 0-9, and _'),
        validators=[
            Regexp('\\w+',
                   message='File name can only contain word '
                   'characters: A-Z, a-z, 0-9, and _')
        ])
    sample_form = FormField(APTSampleDescriptionForm,
                            description="Metadata that describes the sample")
    collection_form = FormField(
        APTCollectionMethodForm,
        description="Metadata for data collection method")
    preparation_form = FormField(APTSamplePreparationForm,
                                 description="Metadata for sample preparation")
    rhit_file = FileField('RHIT file', validators=[Optional()])
Esempio n. 12
0
class RegistrationForm(Form):
    first_name = StringField(_('First name'), [validators.InputRequired()])
    last_name = StringField(_('Last name'), [validators.InputRequired()])
    email = EmailField(_('Email'), [
        validators.InputRequired(),
        validators.Email(), auth_validators.check_unique_email
    ])
    email_confirm = EmailField(_('Confirm Email'), [
        validators.InputRequired(),
        validators.Email(), auth_validators.check_unique_email,
        validators.EqualTo('email', message=_('Emails must match'))
    ])
    # country = SelectField(_('Country'), [validators.required(), ], coerce=int,
    #                       choices=db.session.query(Country.id, Country))
    password = PasswordField(_('Password'), [
        validators.InputRequired(),
        validators.EqualTo('confirm_password',
                           message=_('Passwords must match')),
        validators.Length(min=6, message=_('Minimum length for password is 6'))
    ])
    confirm_password = PasswordField(_('Confirm Password'),
                                     [validators.InputRequired()])
    avatar = FileField('Select your avatar')
Esempio n. 13
0
class FormVereador(FlaskForm):
    id = HiddenField(validators=[Optional()])
    nome_civil = StringField("Nome Civil", validators=[DataRequired()])
    nome_urna = StringField("Nome de Urna", validators=[DataRequired()])
    naturalidade = StringField("Naturalidade", validators=[DataRequired()])
    uf = StringField("UF", validators=[DataRequired()])
    ocupacao = StringField("Ocupação", validators=[DataRequired()])
    escolaridade = SelectField(
        "Escolaridade",
        choices=[
            ("Ensino Fundamental", "Ensino Fundamental"),
            ("Ensino Médio", "Ensino Médio"),
            ("Ensino Superior", "Ensino Superior"),
        ],
        default="Ensino Médio",
    )
    partido = StringField("Partido", validators=[DataRequired()])
    legislaturas = StringField("Legislatura", validators=[DataRequired()])
    telefone = TelField("Telefone", validators=[Optional()])
    email = EmailField("E-mail", validators=[Optional()])
    nascimento = DateField("Data de Nascimento", validators=[DataRequired()])
    detalhes = TextAreaField("Detalhes", validators=[Optional()])
    thumb = FileField("Fotografia", validators=[Optional()])
Esempio n. 14
0
class HPSJRequestForm(FlaskForm):
    memberid = StringField('Member ID', validators=[Optional()])
    name = StringField('Template Name', validators=[Optional()])
    case_name = StringField('Case Name', validators=[Optional()])
    frequency = StringField('Frequency', validators=[Optional()])
    icd10_1 = StringField('ICD10', validators=[Optional()])
    icd10_2 = StringField('ICD10', validators=[Optional()])
    icd10_3 = StringField('ICD10', validators=[Optional()])
    icd10_4 = StringField('ICD10', validators=[Optional()])
    icd10_5 = StringField('ICD10', validators=[Optional()])
    icd10_6 = StringField('ICD10', validators=[Optional()])
    icd10_7 = StringField('ICD10', validators=[Optional()])
    cpt_1 = StringField('CPT', validators=[Optional()])
    cpt_2 = StringField('CPT', validators=[Optional()])
    cpt_3 = StringField('CPT', validators=[Optional()])
    cpt_4 = StringField('CPT', validators=[Optional()])
    cpt_5 = StringField('CPT', validators=[Optional()])
    cpt_6 = StringField('CPT', validators=[Optional()])
    cpt_7 = StringField('CPT', validators=[Optional()])
    unit_1 = IntegerField('Unit', validators=[Optional()])
    unit_2 = IntegerField('Unit', validators=[Optional()])
    unit_3 = IntegerField('Unit', validators=[Optional()])
    unit_4 = IntegerField('Unit', validators=[Optional()])
    unit_5 = IntegerField('Unit', validators=[Optional()])
    unit_6 = IntegerField('Unit', validators=[Optional()])
    unit_7 = IntegerField('Unit', validators=[Optional()])
    start_date = DateField('Start Date',
                           format='%m/%d/%Y',
                           validators=[Optional()])
    end_date = DateField('End Date',
                         format='%m/%d/%Y',
                         validators=[Optional()])
    file = FileField('File')
    message = StringField('Message', validators=[Optional()])
    urgent = BooleanField('Urgent', validators=[Optional()])
    emr = BooleanField('EMR', validators=[Optional()])
    submit = SubmitField('Add Member')
Esempio n. 15
0
 def process(self, formdata, *args, **kw):
     if formdata.getlist("delete-avatar"):
         self.delete = True
     else:
         self.delete = False
     return FileField.process(self, formdata, *args, **kw)
Esempio n. 16
0
class AnalysisForm(Form):
    """Form for the results of a dataset analysis

    TODO: Consider adding fields where users can describe each file being uploaded. The idea would be that the
    form adds new fields after the user uploads the files"""

    title = StringField('Title',
                        description='Short description of the analysis')
    folder_name = StringField(
        'Folder Name',
        description='Name of folder to hold data.',
        render_kw=dict(
            pattern='\\w+',
            title='Only word characters allowed: A-Z, a-z, 0-9, and _'),
        validators=[
            Regexp('\\w+',
                   message='Reconstruction name can only contain word '
                   'characters: A-Z, a-z, 0-9, and _')
        ])
    description = TextAreaField(
        'Description',
        description='Description of what this analysis results are. It is good '
        'practice to describe the contents of the files you will '
        'be uploading.')
    files = FileField('Files',
                      description='Files associated with this analysis',
                      render_kw={'multiple': None})

    def get_presets(self):
        """Generate a list of pre-defined names and descriptions

        These lists are used within the website to pre-fill results

        :return: OrderedDict, where each item holds the values for the above forms"""

        return OrderedDict(
            conc_profile={
                'title': 'Concentration Profile',
                'folder_name': 'Concentration_Profile',
                'description': '1D concentration profile (e.g., proxigram)',
            },
            mass_spec={
                'title': 'Mass Spectrum',
                'folder_name': 'Mass_Spectrum',
                'description': 'Spectrum of the mass to charge ratio'
            },
            bulk_comp={
                'title': 'Bulk Composition',
                'folder_name': 'Bulk_Composition',
                'description':
                'Bulk composition of the tip of region of interest'
            },
            dist_analysis={
                'title': 'Distribution Analysis',
                'folder_name': 'Distribution_Analysis',
                'description': 'Spatial distribution analysis'
            },
            twod_map={
                'title': '2D Map',
                'folder_name': '2D_Map',
                'description': 'Two dimensional projection of reconstruction'
            },
            threed_map={
                'title': '3D Map',
                'folder_name': '3D_Map',
                'description':
                'Three dimensional visualization of reconstruction'
            })