예제 #1
0
class EventQRCodeForm(CustomFlaskForm):
    name = 'Event QR'
    QRFormat = \
        """
        BEGIN:VEVENT\r\n
        SUMMARY:{summary}\r\n
        DTSTART:{start}\r\n
        DTEND:{end}\r\n
        END:VEVENT\r\n
        """

    # DTSTART:19980118T073000Z

    DATE_FORMAT = '%Y%m%d'
    TIME_FORMAT = 'T%H%M00Z'

    @classmethod
    def to_qr_string(cls, dict) -> str:
        try:
            dtstart = datetime.strptime(
                f'{dict["dtpicker_start_date"]} {dict["start_hour"]}',
                '%d/%m/%Y %H:%M')
            dtstart = dtstart.strftime(cls.DATE_FORMAT + cls.TIME_FORMAT)
        except:
            dtstart = datetime.now().strftime(cls.DATE_FORMAT +
                                              cls.TIME_FORMAT)

        try:
            dtend = datetime.strptime(
                f'{dict["dtpicker_end_date"]} {dict["end_hour"]}',
                '%d/%m/%Y %H:%M')
            dtend = dtend.strftime(cls.DATE_FORMAT + cls.TIME_FORMAT)
        except:
            dtend = datetime.now().strftime(cls.DATE_FORMAT + cls.TIME_FORMAT)

        return cls.QRFormat.format(summary=dict['event_name'],
                                   start=dtstart,
                                   end=dtend)

    event_name = StringField(
        label='Event',
        validators=[InputRequired()],
        render_kw={'placeholder': 'My birthday! Please come, I\'m lonely'})

    start_hour = TimeField(label='Starts at')
    end_hour = TimeField(label='Ends at')

    dtpicker_start_date = DateField(label='Begins')
    dtpicker_end_date = DateField(label='Ends')
예제 #2
0
파일: forms.py 프로젝트: kum83/quickauths
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')
예제 #3
0
class FormDiaria(FlaskForm):
    id = HiddenField(validators=[Optional()])
    nome = StringField("Nome", validators=[DataRequired()])
    data = DateField("Data", validators=[DataRequired()])
    destino = StringField("Destino", validators=[DataRequired()])
    motivo = StringField("Motivo", validators=[DataRequired()])
    valor = DecimalField("Valor", validators=[DataRequired()])
예제 #4
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')
예제 #5
0
class PartidaForm(FlaskForm):
    nombre = StringField('Nombre partida',
                         validators=[DataRequired(),
                                     Length(max=200)],
                         render_kw={
                             "type": "text",
                             "class": "form-control",
                             "id": "ldiarioform",
                             'required': ''
                         })
    fecha = DateField('Fecha')
예제 #6
0
class UploadForm(FlaskForm):
    file = FileField()
    type_of_file = SelectField('Type of File', choices=['Expected', 'Actual'])
    month = SelectField('Month',
                        choices=[
                            'January', 'February', 'March', 'April', 'May',
                            'June', 'July', 'August', 'September', 'October',
                            'November', 'December'
                        ],
                        validators=[DataRequired()])
    year = DateField('Year', format="%Y")
    submit = SubmitField('Upload')
예제 #7
0
class FormSessao(FlaskForm):
    id = HiddenField(validators=[Optional()])
    tipo = SelectField(
        "Tipo de sessão",
        choices=[
            ("Sessão Ordinária", "Sessão Ordinária"),
            ("Audiência Pública", "Audiência Pública"),
        ],
        default="Sessão Ordinária",
    )

    data = DateField("Data da sessão", validators=[DataRequired()])
    hora = TimeField("Hora da sessão", validators=[DataRequired()])
    detalhes = TextAreaField("Detalhes/Pauta")
예제 #8
0
파일: forms.py 프로젝트: kum83/quickauths
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')
예제 #9
0
class ExtrasForm(Form):
    code = HiddenField("code")

    participant_roomtype = SelectField("Room type", choices=sel_participant_roomtypes, validators=[
                                       check_participant_roomtype_formconstraint("participant_roompartner", ["guest1_roomtype", "guest2_roomtype"])])
    participant_roompartner = SelectField("Share room with", choices=sel_all_participants)

    participant_arrival = DateField("Arrival", format="%d/%m/%Y",
                                    default=default_arrival_date, validators=[start_date_check])
    participant_departure = DateField("Departure", format="%d/%m/%Y", default=default_departure_date,
                                      validators=[end_date_check, dates_check("participant_arrival")])

    guest1_roomtype = SelectField("Guest 1: room type", choices=sel_guest_roomtypes, validators=[guest_consistency_check(
        "guest1_name"), check_guest_roomtype_formconstraint("participant_roomtype", "guest2_roomtype")])
    guest1_name = StringField("Guest 1: name", render_kw={
                              "placeholder": "Enter the name of Guest 1"})
    guest1_arrival = DateField("Guest 1: arrival date", format="%d/%m/%Y",
                               default=default_arrival_date)
    guest1_departure = DateField("Guest 1: departure date", format="%d/%m/%Y",
                                 default=default_departure_date, validators=[dates_check("guest1_arrival")])

    guest2_roomtype = SelectField("Guest 2: room type", choices=sel_guest_roomtypes, validators=[guest_consistency_check(
        "guest2_name"), check_guest_roomtype_formconstraint("participant_roomtype", "guest1_roomtype")])
    guest2_name = StringField("Guest 2: name", render_kw={
                              "placeholder": "Enter the name of Guest 2"})
    guest2_arrival = DateField("Guest 2: arrival date", format="%d/%m/%Y",
                               default=default_arrival_date)
    guest2_departure = DateField("Guest 2: departure date", format="%d/%m/%Y",
                                 default=default_departure_date, validators=[dates_check("guest2_arrival")])

    num_dinner_friday = IntegerField("Extra Friday dinners", validators=[
                                     validators.NumberRange(min=0)], default=0)
    num_lunch_saturday = IntegerField("Extra Saturday lunches", validators=[
                                      validators.NumberRange(min=0)], default=0)
    num_after_concert = IntegerField("Extra after-show snacks",
                                     validators=[validators.NumberRange(min=0)], default=0)

    # num_show_tickets_regular = IntegerField("Show tickets (regular)", validators=[validators.NumberRange(min=0)], default=0)
    # num_show_tickets_discount = IntegerField("Show tickets (discounted)", validators=[validators.NumberRange(min=0)], default=0)

    guest = TextAreaField(
        "Further guest info", default="Room for any other comments regarding your guests.", render_kw=_taf)

    # sat_dinner_restaurant = SelectField("Restaurant", choices=sel_restaurants, validators=[restaurant_consistency_check("sat_dinner_numpeople")])
    # sat_dinner_numpeople = IntegerField("Number of people", validators=[validators.NumberRange(min=0)], default=0)

    # special_event_tickets = IntegerField("Tickets to special event", validators=[validators.NumberRange(min=0)], default=0)

    # tshirt_sex = SelectField("Style", choices=sel_t_shirt_sexes)
    # tshirt_size = SelectField("Size", choices=sel_t_shirt_sizes)
    # tshirt_spec = SelectField("Color", choices=sel_t_shirt_specs)

    phone = StringField("Your number (optional)")

    other = TextAreaField(
        "Comments", default="Tell us anything else we need to know here.", render_kw=_taf)
예제 #10
0
class MonthDataForm(FlaskForm):
    type_of_file = SelectField('Type of File',
                               choices=['Expected', 'Actual'],
                               validators=[DataRequired()])
    mode = SelectField(
        'Mode', choices=['Monthly', 'Quarterly', 'Half-yearly', 'Annually'])
    month = SelectField('Month',
                        choices=[
                            'January', 'February', 'March', 'April', 'May',
                            'June', 'July', 'August', 'September', 'October',
                            'November', 'December'
                        ],
                        validators=[DataRequired()])
    year = DateField('Year', format="%Y")
    submit1 = SubmitField('Submit')
예제 #11
0
class DeleteDataForm_Sal(FlaskForm):
    dep_num = SelectField('Inter Department Name',
                          choices=[
                              '--', 'Dep-Admin', 'Sales-Dep:1', 'Sales-Dep:2',
                              'Sales-Dep:3'
                          ],
                          validators=[DataRequired()])
    type_of_file = SelectField('Type of File', choices=['Expected', 'Actual'])
    month = SelectField('Month',
                        choices=[
                            'January', 'February', 'March', 'April', 'May',
                            'June', 'July', 'August', 'September', 'October',
                            'November', 'December'
                        ],
                        validators=[DataRequired()])
    year = DateField('Year', format="%Y", validators=[DataRequired()])
    submit = SubmitField('Delete')
예제 #12
0
class OrderForm(FlaskForm):

    CustomerName = StringField('CustomerName')
    JobName = StringField('JobName')
    destination = StringField('Destination')
    po = StringField('PO')
    city = SelectField('City',
                       choices=[('fw', 'Fort Worth'), ('dal', 'Dallas')])
    MapscoLocation = StringField('MapscoLocation')
    JobNumber = StringField('JobNumber')
    MaterialName = StringField('MaterialName')
    LoadTotal = IntegerField('LoadTotal')
    Source = StringField('Source')
    lookup = SubmitField('LookUp')
    submit = SubmitField('Submit')
    creation_date = DateField("Date", default=date.today())
    contact = StringField("Contact")
    Status = SelectField('Status',
                         choices=[('InTransit', 'InTransit'),
                                  ('Delivered', 'Delivered'),
                                  ('Cancelled', 'Cancelled')])
예제 #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()])
예제 #14
0
파일: forms.py 프로젝트: cloudbrk/WODBrain
class LogLiftForm(FlaskForm):
    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'),
                ]
    )
    rep = IntegerField("How many unbroken reps?", widget=TelInput())
    load = IntegerField("How much weight did you lift?",widget=TelInput())
    date = DateField("Date", widget=DateInput())
    submit = SubmitField("Log Lift")
예제 #15
0
        class NameForm(self.form_base_class):
            """
                Form with a filename input field.

                Validates if provided name is valid for *nix and Windows systems.
            """
            if directory is not None:
                try:
                    default = directory.split('/')
                    default_model = get_default(DEFAULT_MODELS, default)
                    default_chapter = get_default(DEFAULT_CHAPTERS, default)
                except ValueError:
                    default_model = None
                    default_chapter = None
            name = fields.StringField(
                lazy_gettext(u'重名命'),
                validators=[validators.Required(), validate_name])
            path = fields.HiddenField()

            office = MySelectField(label=lazy_gettext(u'处室'),
                                   coerce=unicode,
                                   choices=[(u'航线处', u'航线处'),
                                            (u'技术服务处', u'技术服务处'),
                                            (u'质量处', u'质量处')])
            model = MySelectField(
                label=lazy_gettext(u'机型'),
                coerce=int,
                choices=[(737, '737'), (757, '757'), (787, '787')],
                default=default_model if default_model is not None
                and default_model in DEFAULT_MODELS else None)
            chapter = MyRadioField(
                label=u'章节号',
                coerce=int,
                choices=[
                    (0o5, u'05时间限制'),
                    (0o6, u'06尺寸和区域'),
                    (12, u'12勤务'),
                    (20, u'20标准施工'),
                    (21, u'21空调'),
                    (22, u'22自动驾驶'),
                    (23, u'23通讯'),
                    (24, u'24电源'),
                    (25, u'25设备与装饰'),
                    (26, u'26防火'),
                    (27, u'27飞行操纵'),
                    (28, u'28燃油'),
                    (29, u'29液压系统'),
                    (30, u'30防冰防雨'),
                    (31, u'31指示系统'),
                    (32, u'32起落架'),
                    (33, u'33灯光'),
                    (34, u'34导航'),
                    (35, u'35氧气系统'),
                    (36, u'36引气系统'),
                    (38, u'38饮用水和灰水系统'),
                    (47, u'47NGS'),
                    (49, u'49辅助动力装置'),
                    (51, u'51结构'),
                    (52, u'52门'),
                    (53, u'53机身'),
                    (54, u'54发动机短舱和吊架'),
                    (55, u'55安定面'),
                    (56, u'56窗户'),
                    (57, u'57机翼'),
                    (70, u'70standard practices'),
                    (71, u'71飞行动力'),
                    (72, u'72发动机'),
                    (73, u'73发动机燃油和控制'),
                    (74, u'74发动机点火'),
                    (75, u'75发动机空气'),
                    (76, u'76发动机控制'),
                    (77, u'77发动机指示'),
                    (78, u'78发动机排气'),
                    (79, u'79发动机滑油'),
                    (80, u'80发动机起动'),
                ],
                default=default_chapter[0:2] if default_chapter is not None
                and default_chapter in DEFAULT_CHAPTERS else None)
            date = DateField(label=u'编辑日期',
                             format='%m/%d/%Y',
                             widget=DatePickerWidget())
예제 #16
0
        class UploadForm(self.form_base_class):
            """
                File upload form. Works with FileAdmin instance to check if it
                is allowed to upload file with given extension.
            """
            if directory is not None:
                try:
                    default = directory.split('/')
                    default_model = get_default(DEFAULT_MODELS, default)
                    default_chapter = get_default(DEFAULT_CHAPTERS, default)
                except ValueError:
                    default_model = None
                    default_chapter = None
            upload = MyFileField(lazy_gettext(u'上传文件'))
            office = MySelectField(label=lazy_gettext(u'处室'),
                                   coerce=unicode,
                                   choices=[(u'航线处', u'航线处'),
                                            (u'技术服务处', u'技术服务处'),
                                            (u'质量处', u'质量处')])
            model = MySelectField(
                label=lazy_gettext(u'机型'),
                coerce=int,
                choices=[(737, '737'), (757, '757'), (787, '787')],
                default=default_model if default_model is not None
                and default_model in DEFAULT_MODELS else None)
            chapter = MyRadioField(
                label=u'章节号',
                coerce=int,
                choices=[
                    (0o5, u'05时间与限制'),
                    (0o6, u'06尺寸和区域'),
                    (12, u'12勤务'),
                    (20, u'20标准施工'),
                    (21, u'21空调'),
                    (22, u'22自动驾驶'),
                    (23, u'23通讯'),
                    (24, u'24电源'),
                    (25, u'25设备与装饰'),
                    (26, u'26防火'),
                    (27, u'27飞行操纵'),
                    (28, u'28燃油'),
                    (29, u'29液压系统'),
                    (30, u'30防冰防雨'),
                    (31, u'31指示系统'),
                    (32, u'32起落架'),
                    (33, u'33灯光'),
                    (34, u'34导航'),
                    (35, u'35氧气系统'),
                    (36, u'36引气系统'),
                    (38, u'38饮用水和灰水系统'),
                    (47, u'47NGS'),
                    (49, u'49辅助动力装置'),
                    (51, u'51结构'),
                    (52, u'52门'),
                    (53, u'53机身'),
                    (54, u'54发动机短舱和吊架'),
                    (55, u'55安定面'),
                    (56, u'56窗户'),
                    (57, u'57机翼'),
                    (70, u'70standard practices'),
                    (71, u'71飞行动力'),
                    (72, u'72发动机'),
                    (73, u'73发动机燃油和控制'),
                    (74, u'74发动机点火'),
                    (75, u'75发动机空气'),
                    (76, u'76发动机控制'),
                    (77, u'77发动机指示'),
                    (78, u'78发动机排气'),
                    (79, u'79发动机滑油'),
                    (80, u'80发动机起动'),
                ],
                default=default_chapter[0:2] if default_chapter is not None
                and default_chapter in DEFAULT_CHAPTERS else None)
            date = DateField(label=u'编辑日期',
                             format='%m/%d/%Y',
                             widget=DatePickerWidget())

            def __init__(self, *args, **kwargs):
                super(UploadForm, self).__init__(*args, **kwargs)
                self.admin = kwargs['admin']

            def validate_upload(self, field):
                if not self.upload.data:
                    raise validators.ValidationError(gettext('File required.'))

                filename = self.upload.data.filename

                if not self.admin.is_file_allowed(filename):
                    raise validators.ValidationError(
                        gettext('Invalid file type.'))
예제 #17
0
파일: forms.py 프로젝트: kum83/quickauths
class EligibilityForm(FlaskForm):
    memberid = StringField('Member ID', validators=[DataRequired()])
    dob = DateField('Date of Birthh',
                    format='%m/%d/%Y',
                    validators=[Optional()])
    submit = SubmitField('Add')
예제 #18
0
파일: forms.py 프로젝트: zihuxinyu/mbp
class SearchForm(BaseForm):
    startdate = DateField('起始时间', validators=[Required()])
    enddate = DateField('结束时间', validators=[Required()])
    t = TextField('类型')
예제 #19
0
class Tablesform(FlaskForm):
    number_people = IntegerField("number please")
    time_booked = DateField("YYYY-MM-DD")
    meal_id = IntegerField("meal_id")
    submit = SubmitField("Book")
예제 #20
0
class FiltroFechas(FlaskForm):
    fechaInicio = DateField('Inicio', format='%Y-%m-%d')
    fechaFin = DateField('Fin', format='%Y-%m-%d')
    submit = SubmitField('Filtrar')