Exemple #1
0
class ExtDateField(FieldForm):
    date = DateField()
Exemple #2
0
class SurgeryBlockForm(BaseForm):
    fld_surgery_block_id = StringField("Surgical Block ID", default=tbd)
    fld_surgery_no_of_blocks = IntegerField("Number of blocks", default=tbd)
    fld_surgery_block_source = SelectField(
        "Mention the laboratory from where the reports have been generated",
        choices=BiopsyDict.biopsy_block_source_choice
    )  # use same dict as biopsy
    fld_surgery_block_source_other = StringField("other")
    fld_nact_or_naht = SelectField("is NACT or NAHT done",
                                   choices=BiopsyDict.nact_naht_choice)
    fld_nact_or_naht_other = StringField("Give details")
    fld_surgery_tumour_block_reference = TextAreaField(
        "Tumour block reference", default=tbd)
    fld_surgery_nodes_block_reference = TextAreaField("Nodes block reference",
                                                      default=tbd)
    fld_surgery_adjacent_normal_block_reference = TextAreaField(
        "Adjacent Normal block reference", default=tbd)
    fld_surgery_reduction_tissue_block_reference = TextAreaField(
        "Reduction Tissue block reference", default=tbd)
    fld_surgery_date = DateField("Date of Surgery")
    fld_surgery_name_surgeon_id = StringField("Name of Surgeon",
                                              default='Dr. Koppiker')
    fld_surgery_hospital_id = StringField("Hospital ID", default=tbd)
    fld_reason_for_biopsy = StringField("Reason for biopsy", default=tbd)
    fld_surger_lesion_side = SelectField("Lesion Side",
                                         choices=CommonDict.breast_choice)
    fld_surger_lesion_side_other = StringField("Other")
    fld_surgery_right_breast_type = SelectField(
        "Type of Surgery for Right Breast",
        choices=BiopsyDict.surgery_type_choice)
    fld_surgery_right_breast_type_other = StringField("Other")
    fld_surgery_left_breast_type = SelectField(
        "Type of Surgery for Left Breast",
        choices=BiopsyDict.surgery_type_choice)
    fld_surgery_left_breast_type_other = StringField("Other")
    fld_surgery_tumour_size = StringField("Tumour size", default=tbd)
    fld_surgery_tumour_size_unit = StringField('Unit for tumour size',
                                               default='cm')
    fld_surgery_tumour_grade = SelectField(
        "Tumour Grade", choices=BiopsyDict.tumour_grade_choice)
    fld_surgery_tumour_grade_other = StringField("Other")
    fld_surgery_surgery_diagnosis = SelectField(
        "Surgery Diagnosis", choices=BiopsyDict.surgery_diagnosis_choice)
    fld_surgery_surgery_diagnosis_other = StringField("Other")
    fld_diagnosis_comment = StringField(
        "Include descriptive or indicative notes here and not in Diagnosis")
    fld_surgery_block_DCIS_percent = StringField("mention the DCIS percent")
    fld_surgery_perineural_invasion = SelectField(
        "Perineural Invasion", choices=CommonDict.absent_present_choice)
    fld_surgery_perineural_invasion_other = StringField("Other")
    fld_surgery_necrosis = SelectField(
        "Necrosis", choices=CommonDict.absent_present_choice)
    fld_surgery_necrosis_other = StringField("Other")
    fld_surgery_block_report_lymphovascular_invasion = SelectField(
        "Is lymphovascular invasion seen?",
        choices=BiopsyDict.lymphovascular_invasion_choice)
    fld_surgery_er = SelectField("Surgical block ER Status",
                                 choices=CommonDict.postive_negative_choice)
    fld_surgery_er_other = StringField("Other")
    fld_surgery_er_percent = StringField("ER Percent", default="0")
    fld_surgery_pr = SelectField("Surgical block PR Status",
                                 choices=CommonDict.postive_negative_choice)
    fld_surgery_pr_other = StringField("Other")
    fld_surgery_pr_percent = StringField("PR Percent", default="0")
    fld_surgery_her2 = SelectField("Surgical block HER2 Status",
                                   choices=BiopsyDict.tumour_her2_choice)
    fld_surgery_her2_other = StringField("Other")
    fld_surgery_her2_grade = StringField("HER2 Grade", default="0")
    fld_surgery_fish = SelectField("Tumour block FISH",
                                   choices=CommonDict.postive_negative_choice)
    fld_surgery_ki67 = StringField("Ki67 Percent", default="0")
    fld_surgery_block_report_sentinel_node_number_removed = IntegerField(
        "if sentinel nodes are removed,"
        "enter the number of nodes removed",
        default=tbd)
    fld_surgery_block_report_sentinel_node_number_removed_other = StringField(
        "NA")
    fld_surgery_block_report_sentinel_node_number_positive = IntegerField(
        "if sentinel nodes are removed,"
        "enter the number of nodes positive",
        default=tbd)
    fld_surgery_block_report_sentinel_node_number_positive_other = StringField(
        "NA")
    fld_surgery_block_report_axillary_node_number_positive = IntegerField(
        "if axillary nodes are removed,"
        "enter the number of nodes positive",
        default=tbd)
    fld_surgery_block_report_axillary_node_number_positive_other = StringField(
        "NA")
    fld_surgery_block_report_apical_node_number_positive = IntegerField(
        "if apical nodes are removed,"
        "enter the number of nodes positive",
        default=tbd)
    fld_surgery_block_report_apical_node_number_positive_other = StringField(
        "NA")
    fld_node_block_report_perinodal_spread = SelectField(
        "Block Report Perinodal spread",
        choices=BiopsyDict.lymphovascular_invasion_choice)
    fld_node_block_report_perinodal_spread_other = StringField(
        "Requires follow-up")
    fld_pathological_staging_pt = SelectField(
        "Pathological staging pT",
        choices=BiopsyDict.pathological_staging_pt_choice)
    fld_pathological_staging_pt_other = StringField("other")
    fld_pathological_staging_pn = SelectField(
        "Pathological staging pN",
        choices=BiopsyDict.pathological_staging_pt_choice)
    fld_pathological_staging_pn_other = StringField("other")
    fld_pathological_staging_m = SelectField(
        "Pathological staging M",
        choices=BiopsyDict.pathological_staging_m_choice)
    fld_pathological_staging_m_other = StringField("other")
    fld_pathological_staging_p_stage = SelectField(
        "Pathological staging p",
        choices=BiopsyDict.pathological_staging_p_stage_choice)
    fld_additional_comments = StringField("Additional comments", default=tbd)
    fld_stromal_tumour_infiltrating_lymphocytes = StringField(
        "Stromal Tumor infiltrating lymphocytes", default=tbd)
    fld_tumour_desmoplastic_response = StringField(
        "Tumor desmoplastic response", default=tbd)
class AlunoForm(FlaskForm):
    matricula = TextField('Matrícula', validators=[DataRequired()])
    dt_nascimento = DateField('Data de Nascimento', format="%Y-%m-%d" ,validators=[DataRequired()])
    entrar = SubmitField('Entrar')
Exemple #4
0
class UserPartyTransactionReportForm(FlaskForm):
	dateTo = DateField('dateTo', format='%Y-%m-%d')
	dateFrom = DateField('dateFrom', format='%Y-%m-%d')
	submit = SubmitField('Generate Report')
Exemple #5
0
class MeetingForm(FlaskForm):
    title = StringField('Title', validators=[InputRequired()])
    date = DateField('DatePicker', format='%Y-%m-%d', validators=[InputRequired()])
    time = StringField('Time', validators=[InputRequired()])
    description = StringField('Description', validators=[InputRequired()])
    link = StringField('Link', validators=[URL()]) 
Exemple #6
0
class GivenTime(Form):
    StartDate = DateField('date', validators=[DataRequired()])
    EndDate = DateField('date', validators=[DataRequired()])
Exemple #7
0
class ConfirmOrderForm(FlaskForm):
    order_date = DateField('Pick up Date',validators=[DataRequired()])
    submit = SubmitField('Confirm order')
Exemple #8
0
class MemberForm(FlaskForm):
    izina_ribanzax = StringField("Izina ribanza",
                                 validators=[DataRequired()],
                                 render_kw={
                                     "placeholder": "Injizamo Izina ribanza",
                                     "id": "izina_ribanza"
                                 })
    izina_rikurikirax = StringField("Izina rikurikira",
                                    validators=[DataRequired()],
                                    render_kw={
                                        "placeholder":
                                        "Injizamo Izina rikurikira",
                                        "id": "izina_rikurikira"
                                    })
    ayandix = StringField("Ayandi (Singombwa)",
                          render_kw={
                              "placeholder": "Ayandi (Singombwa)",
                              "id": "ayandi"
                          })
    igitsinax = SelectField('Igitsina',
                            choices=[('Igitsina', 'Igitsina'),
                                     ('Gabo', 'Gabo'), ('Gore', 'Gore')])
    indangamuntux = IntegerField("Indangamuntu",
                                 validators=[DataRequired()],
                                 render_kw={
                                     "placeholder":
                                     "Injiza nomero y'indangamuntu",
                                     "id": "indangamuntu"
                                 })
    codex = StringField("Code",
                        validators=[DataRequired()],
                        render_kw={
                            "placeholder": "Shyiramo code y'umunyamuryango",
                            "id": "code"
                        })

    tariki_yavukiyex = DateField("Tariki y'amavuko",
                                 format='%Y-%m-%d',
                                 validators=[DataRequired()])
    intarax = StringField("Intara",
                          validators=[DataRequired()],
                          render_kw={
                              "placeholder": "Injiza intara",
                              "id": "intara"
                          })
    akarerex = StringField("Akarere",
                           validators=[DataRequired()],
                           render_kw={"placeholder": "Injiza akarere"})
    umurengex = StringField("Umurenge",
                            validators=[DataRequired()],
                            render_kw={"placeholder": "Injiza umurenge"})
    akagarix = StringField("Akagari",
                           validators=[DataRequired()],
                           render_kw={"placeholder": "Injiza akagari"})

    umudugudux = StringField("Umudugudu",
                             validators=[DataRequired()],
                             render_kw={
                                 "placeholder": "Injizamo Umudugudu",
                                 "id": "umudugudu"
                             })
    tariki_yinjiriyex = DateField("Taliki y'injiriye",
                                  format='%Y-%m-%d',
                                  validators=[DataRequired()])
    umugabanex = StringField("Umugabane Shingiro",
                             validators=[DataRequired()],
                             render_kw={
                                 "placeholder":
                                 "Injizamo Umugabane w'umunyamuryango",
                                 "id": "umugabane"
                             })
    umukonox = StringField("Umukono",
                           validators=[DataRequired()],
                           render_kw={
                               "placeholder":
                               "Injizamo Umukono w'umunyamuryango",
                               "id": "umukono"
                           })
    nomero_ya_telephonex = StringField("Nimero ya telephone",
                                       validators=[DataRequired()],
                                       render_kw={
                                           "placeholder":
                                           "Shyiramo numero ya telephone",
                                           "id": "nomero_ya_telephone"
                                       })

    amashurix = SelectField('Amashuri',
                            choices=[('Amashuri', 'Amashuri'),
                                     ('Abatarize', 'Abatarize'),
                                     ('Abanza', 'Abanza'),
                                     ('Ayisumbuye', 'Ayisumbuye'),
                                     ('Kaminuza', 'Kaminuza'),
                                     ('Imyuga', 'Imyuga')])
    ubumugax = SelectField('Ubumuga/Uburwayi',
                           choices=[('Ntabwo', 'Ntabwo'),
                                    ('Ubumuga', 'Ubumuga'),
                                    ('Amaguru', 'Amaguru'),
                                    ('Amaboko', 'Amaboko'),
                                    ('Kutabona', 'Kutabona'),
                                    ('Kutumva', 'Kutumva'),
                                    ('Mu mutwe', 'Mu mutwe'),
                                    ('HIV/AIDS', 'HIV/AIDS'),
                                    ('Ibindi', 'Ibindi')])
    arubatsex = SelectField('Arubatse?',
                            choices=[('Arubatse', 'Arubatse'),
                                     ('Yego', 'Yego'), ('Oya', 'Oya')])
    umubare_wabanax = IntegerField(
        "Umubare w'abana",
        validators=[Optional()],
        render_kw={"placeholder": "Shyiramo Umubare w'abana niba ubafite"})
    icyiciro_cyubudehex = StringField(
        "Icyiciro cy'ubudehe",
        validators=[DataRequired()],
        render_kw={"placeholder": "Icyiciro cy'ubudehe"})
    ubwishingizix = StringField(
        "Ubwishingizi",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo ubwishingizi bw'umunyamuryango"})
    akazi_akora_muri_koperativex = StringField(
        "Akazi Akora Muri Koperative",
        validators=[DataRequired()],
        render_kw={
            "placeholder":
            "Shyiramo akazi umunyamuryango akora muri Koperative"
        })
    akandi_kazi_akorax = StringField(
        "Akandi kazi akora",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Akandi kazi akora"})
    ubuso_ahingahox = StringField(
        "Ubuso ahingaho icyayi",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Ubuso ahingaho icyayi"})

    ubwoko_bwigihingwax = StringField(
        "Ubwoko bw'igihingwa (Icyayi)",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Ubwoko bw'igihingwa (Cy'icyayi)"})
    ubuso_ahingaho_ibindix = StringField(
        "Ubuso ahingaho ibindi",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Ubuso ahingaho ibindi"})
    ubwoko_bwigihingwa_kindix = StringField(
        "Ubwoko bw'ikindi gihingwa",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Ubwoko bw'ikindi gihingwa ahinga"})
    ubuso_budakoreshwax = StringField(
        "Ubuso budakoreshwa",
        validators=[DataRequired()],
        render_kw={"placeholder": "Shyiramo Ubuso bundi budakoreshwa"})

    submit = SubmitField('Injiza Umunyamuryango')
    """
Exemple #9
0
class AddToDoForm(FlaskForm):
    task = StringField('Task', validators=[DataRequired()])
    due_date = DateField('Due Date',
                         format='%Y-%m-%d',
                         validators=[DataRequired()])
    submit = SubmitField('Add Task')
Exemple #10
0
class ProjectForm(FlaskForm):
    name = StringField('Name', validators=[DataRequired()])
    description = StringField('Description', validators=[DataRequired()])
    start = DateField(id='datepick', validators=[DataRequired()])
    submit = SubmitField('Submit')
Exemple #11
0
class MeasureVersionForm(FlaskForm):
    class NotRequiredForMajorVersions:
        def __call__(self, form: "MeasureVersionForm", field):
            if not form.is_minor_update:
                field.errors[:] = []
                raise StopValidation()

    class OnlyIfUpdatingDataMistake:
        def __call__(self, form: "MeasureVersionForm", field):
            if not form.update_corrects_data_mistake.data:
                field.errors[:] = []
                raise StopValidation()

    db_version_id = IntegerField(widget=HiddenInput())
    title = RDUStringField(
        label="Title",
        validators=[DataRequired(message="Enter a page title"), Length(max=255)],
        hint="For example, ‘Self-harm by young people in custody’",
    )
    internal_reference = RDUStringField(
        label="Measure code (optional)", hint="This is for internal use by the Race Disparity Unit"
    )
    published_at = DateField(label="Publication date", format="%Y-%m-%d", validators=[Optional()])
    time_covered = RDUStringField(
        label="Time period covered",
        validators=[RequiredForReviewValidator(message="Enter the time period covered")],
        extended_hint="_time_period_covered.html",
    )

    area_covered = RDUCheckboxField(
        label="Areas covered", enum=UKCountry, validators=[RequiredForReviewValidator(message="Enter the area covered")]
    )

    lowest_level_of_geography_id = RDURadioField(
        label="Geographic breakdown",
        hint="Select the most detailed type of geographic breakdown available in the data",
        validators=[RequiredForReviewValidator(message="Select the geographic breakdown", else_optional=True)],
    )
    suppression_and_disclosure = RDUTextAreaField(
        label="Suppression rules and disclosure control (optional)",
        hint="If any data has been excluded from the analysis, explain why.",
        extended_hint="_suppression_and_disclosure.html",
    )
    estimation = RDUTextAreaField(
        label="Rounding (optional)", hint="For example, ‘Percentages are rounded to one decimal place’"
    )

    summary = RDUTextAreaField(
        label="Main points",
        validators=[RequiredForReviewValidator(message="Enter the main points")],
        hint=Markup(
            "<p class='govuk-body govuk-hint'>Summarise the main findings. Don’t include contextual information.</p>"
            "<details class='govuk-details' data-module='govuk-details'>"
            "<summary class='govuk-details__summary'>"
            "<span class='govuk-details__summary-text'>"
            "What to include"
            "</span>"
            "</summary>"
            "<div class='govuk-details__text'>"
            "<ul class='govuk-list govuk-list--bullet'>"
            "<li>the time period the data covers (in the first bullet point)</li>"
            "<li>definitions of any terms users might not understand</li>"
            "<li>details of any serious issues with data quality</li>"
            "</ul>"
            "</div>"
            "</details>"
        ),
        extended_hint="_summary.html",
    )

    measure_summary = RDUTextAreaField(
        label="What the data measures",
        validators=[RequiredForReviewValidator(message="Explain what the data measures")],
        hint=(
            "Explain what the data is analysing, what’s included in categories labelled as ‘Other’ and define any "
            "terms users might not understand"
        ),
    )

    description = RDUTextAreaField(
        label="Description for search engines",
        validators=[RequiredForReviewValidator(message="Enter a description for search engines")],
        hint=(
            "Choose an up‐to‐date statistic that shows a key disparity or change over time. The figure should work as "
            "a stand-alone statement and end with a full stop."
        ),
        extended_hint="_description.html",
        character_count_limit=160,
    )

    need_to_know = RDUTextAreaField(
        label="Things you need to know",
        validators=[RequiredForReviewValidator(message="Explain what the reader needs to know to understand the data")],
        hint="Outline how the data was collected and explain any limitations",
        extended_hint="_things_you_need_to_know.html",
    )

    ethnicity_definition_summary = RDUTextAreaField(
        label="The ethnic categories used in this data",
        validators=[RequiredForReviewValidator(message="List the ethnic categories used in the data")],
        hint=Markup(
            "Only use this section to explain if:"
            "<ul class='govuk-list govuk-list--bullet govuk-hint'>"
            "<li>the standardised list of 18 ethnic groups isn’t being used (ONS 2011)</li>"
            "<li>there's only data for broad ethnic groups, not specific groups</li>"
            "<li>there are different ethnic classifications used in the same measure page</li>"
            "</ul>"
            "<details class='govuk-details' data-module='govuk-details'>"
            "<summary class='govuk-details__summary'>"
            "<span class='govuk-details__summary-text'>"
            "Example"
            "</span>"
            "</summary>"
            "<div class='govuk-details__text'>"
            "The number of people surveyed was too small to make reliable generalisations about specific ethnic groups."
            "So the data is broken down into [number] aggregated ethnic groups."
            "</div>"
            "</details>"
        ),
    )

    methodology = RDUTextAreaField(
        label="Methodology",
        validators=[RequiredForReviewValidator(message="Enter the data’s methodology")],
        hint="Explain in clear, simple language how the data was collected and processed.",
        extended_hint="_methodology.html",
    )
    related_publications = RDUTextAreaField(
        label="Related publications (optional)", extended_hint="_related_publications.html"
    )
    qmi_url = RDUURLField(label="Link to quality and methodology information")
    further_technical_information = RDUTextAreaField(label="Further technical information (optional)")

    # Edit summaries
    update_corrects_data_mistake = RDURadioField(
        label="Are you correcting something that’s factually incorrect?",
        hint="For example, in the data or commentary",
        choices=((True, "Yes"), (False, "No")),
        coerce=lambda value: None if value is None else get_bool(value),
        validators=[
            NotRequiredForMajorVersions(),
            RequiredForReviewValidator("Confirm whether this is a correction", else_optional=True),
        ],
    )
    update_corrects_measure_version = RDURadioField(
        label="In which version did the mistake first appear?",
        coerce=int,
        validators=[
            NotRequiredForMajorVersions(),
            OnlyIfUpdatingDataMistake(),
            RequiredForReviewValidator("Confirm when the mistake first appeared", else_optional=True),
        ],
    )
    external_edit_summary = RDUTextAreaField(
        label="Changes to previous version",
        validators=[RequiredForReviewValidator(message="Summarise changes to the previous version")],
        hint=(
            "If you’ve corrected the data, explain what’s changed and why. Otherwise, summarise what you’ve updated "
            "(for example, ‘Updated with the latest available data’)."
        ),
    )
    internal_edit_summary = RDUTextAreaField(
        label="Notes (for internal use - optional)",
        hint="Include any additional information someone might need if they’re working on this page in the future",
    )

    def __init__(
        self, is_minor_update: bool, sending_to_review=False, previous_minor_versions=tuple(), *args, **kwargs
    ):
        super(MeasureVersionForm, self).__init__(*args, **kwargs)

        self.is_minor_update = is_minor_update
        self.sending_to_review = sending_to_review

        # Major versions are not considered "corrections to data mistakes", and the question is not shown to end users.
        # So let's provide the default value here.
        if not self.is_minor_update:
            self.update_corrects_data_mistake.data = False

        choices = []
        geographic_choices = LowestLevelOfGeography.query.order_by("position").all()
        for choice in geographic_choices:
            if choice.description is not None:
                description = "%s %s" % (choice.name, choice.description)
                choices.append((choice.name, description))
            else:
                choices.append((choice.name, choice.name))

        self.lowest_level_of_geography_id.choices = choices

        if kwargs.get("obj", None):
            self.internal_reference.data = kwargs["obj"].measure.reference or ""

        if previous_minor_versions or kwargs.get("obj", None):
            self.update_corrects_measure_version.choices = tuple(
                [
                    (measure_version.id, measure_version.version)
                    for measure_version in (previous_minor_versions or kwargs.get("obj", None).previous_minor_versions)
                ]
            )

        else:
            self.update_corrects_measure_version.choices = tuple()

    def populate_obj(self, obj: MeasureVersion):
        super().populate_obj(obj)

        # We only want to record the related measure version if this is actually a correction
        if self.update_corrects_data_mistake.data is not True:
            obj.update_corrects_measure_version = None

    def error_items(self):
        return self.errors.items()
Exemple #12
0
class TaskForm(Form):
    date = DateField('date', validators=[DataRequired()])
    title = StringField('title', validators=[DataRequired()])
    description = StringField('description', validators=[DataRequired()])
    status = BooleanField('status')
Exemple #13
0
class AddTaskForm(FlaskForm):
    newtask = StringField("newtask", validators=[DataRequired()])
    duedate = DateField("duedate",
                        format="%Y-%m-%d",
                        validators=[DataRequired()])
Exemple #14
0
class RegistrationForm(FlaskForm):
    """Template for signup form creation"""

    national_id = IntegerField("National ID", [DataRequired(message="Kindly input your National ID Number")])
    first_name = StringField("First Name", [DataRequired(message="Kindly your first name")])
    surname = StringField("Surname", [DataRequired(message="Kindly input your last name")])
    dob = DateField('Date of Birth', [DataRequired(message="Kindly input your Date of Birth")])
    email = EmailField("Email", [DataRequired(message="Kindly input your Email Address"),
                                 Email(message="Invalid Email Address, missing '@' symbol")])
    home_county = SelectField('County', [DataRequired(message="Kindly select home county")],
                              choices=[('Mombasa', 'Mombasa'), ('Kwale', 'Kwale'), ('Kilifi', 'Kilifi'),
                                       ('Tana River', 'Tana River'), ('Lamu', 'Lamu'), ('Taita-Taveta', 'Taita-Taveta'),
                                       ('Garissa', 'Garissa'), ('Wajir', 'Wajir'), ('Mandera', 'Mandera'),
                                       ('Marsabit', 'Marsabit'), ('Isiolo', 'Isiolo'), ('Meru', 'Meru'),
                                       ('Tharaka-Nithi', 'Tharaka-Nithi'), ('Embu', 'Embu'), ('Kitui', 'Kitui'),
                                       ('Machakos', 'Machakos'), ('Makueni', 'Makueni'), ('Nyandarua', 'Nyandarua'),
                                       ('Nyeri', 'Nyeri'), ('Kirinyaga', 'Kirinyaga'), ('Murang\'a', 'Murang\'a'),
                                       ('Kiambu', 'Kiambu'), ('Turkana', 'Turkana'), ('West Pokot', 'West Pokot'),
                                       ('Samburu', 'Samburu'), ('Trans-Nzoia', 'Trans-Nzoia'),
                                       ('Uasin Gishu', 'Uasin Gishu'), ('Elgeyo-Marakwet', 'Elgeyo-Marakwet'),
                                       ('Nandi', 'Nandi'), ('Baringo', 'Baringo'), ('Laikipia', 'Laikipia'),
                                       ('Nakuru', 'Nakuru'), ('Narok', 'Narok'), ('Kajiado', 'Kajiado'),
                                       ('Kericho', 'Kericho'), ('Bomet', 'Bomet'), ('Kakamega', 'Kakamega'),
                                       ('Vihiga', 'Vihiga'), ('Bungoma', 'Bungoma'), ('Busia', 'Busia'),
                                       ('Siaya', 'Siaya'), ('Kisumu', 'Kisumu'), ('Homa Bay', 'Homa Bay'),
                                       ('Migori', 'Migori'), ('Kisii', 'Kisii'), ('Nyamira', 'Nyamira'),
                                       ('Nairobi', 'Nairobi')])
    password = PasswordField("Password", [DataRequired(message="Input Password"),
                                          Length(min=8, message="Password too short > 8"),
                                          Length(max=16),
                                          EqualTo('confirm_password', message='Passwords must match')])
    confirm_password = PasswordField("Repeat Password", [DataRequired(message="Confirm Password"),
                                                         EqualTo('password', message='Passwords must match')])
    recaptcha = RecaptchaField()
    remember_me = BooleanField('Remember Me')

    def validate_national_id(self, national_id):
        form = RegistrationForm()
        user = User.query.filter_by(national_id=national_id.data).first()
        if user is not None:
            raise ValidationError('National ID already used by a different user')
        if not int(form.national_id.data):
            raise ValidationError('Only numbers allowed on this input')

    def validate_email(self, email):
        user = User.query.filter_by(email=email.data).first()
        if user is not None:
            raise ValidationError('Email address already exists')

    def validate_first_name(self, first_name):
        if not str(first_name):
            raise ValidationError('No special characters eg.(@, #, [space]) allowed, only letters')

    def validate_surname(self, surname):
        if not str(surname):
            raise ValidationError('No special characters eg.(@, #, [space]) allowed, only letters')

    def validate_dob(self, dob):
        form = RegistrationForm()
        if calculate_age(str(form.dob.data)) < 18:
            raise ValidationError('Invalid date of birth, age is less than 18 years')
        if calculate_age(str(form.dob.data)) > 120:
            raise ValidationError('Invalid date of birth, age more than 120 years')
Exemple #15
0
class BiddingForm(FlaskForm):
    ccontact = IntegerField(label='Ccontact',
                            validators=[InputRequired()],
                            render_kw={
                                'placeholder': 'Ccontact',
                                'class': 'input100'
                            })

    petname = SelectField(label='Petname',
                          validators=[InputRequired()],
                          render_kw={
                              'placeholder': 'Petname',
                              'class': 'input100'
                          })
    startday = DateField(label='startday',
                         validators=[InputRequired()],
                         render_kw={
                             'placeholder': 'startday',
                             'class': 'input100'
                         })
    endday = DateField(label='endday',
                       validators=[InputRequired()],
                       render_kw={
                           'placeholder': 'endday',
                           'class': 'input100'
                       })
    paymentmode = SelectField(label='Paymentmode',
                              choices=[('creditcard', 'Credit Card'),
                                       ('cash', 'Cash')],
                              validators=[InputRequired()],
                              render_kw={
                                  'placeholder': 'Paymentmode',
                                  'class': 'input100'
                              })
    deliverymode = SelectField(label='Deliverymode',
                               validators=[InputRequired()],
                               choices=[('deliver', 'pet owner deliver'),
                                        ('pickup', 'pick up'),
                                        ('pcstransfer', 'transfer through PCS')
                                        ],
                               render_kw={
                                   'placeholder': 'Deliverymode',
                                   'class': 'input100'
                               })

    # def edit_user(request, ccontact, petname):
    #     caretaker = Cantakecare.query.get(ccontact)
    #     category = Pets.query.filter_by(petname = petname.data)
    #     form = BiddingForm(request.POST, obj=caretaker)
    #     form.ccontact.choices = [(x.ccontact, x.ccontact) for x in Cantakecare.query.order_by('ccontact').filter_by(category=category)]

    def validate_on_submit(self):
        result = super(BiddingForm, self).validate()
        if (self.startday.data - self.endday.data >= timedelta(minutes=1)):
            flash("End date cannot be earlier than Start date.")
            return False
        elif (date.today() - self.startday.data >= timedelta(minutes=1)):
            flash("Start date cannot be earlier than current date.")
            return False
        else:
            return True
class PersonalData(FlaskForm):
    first_name = StringField(
        'Nome',
        [
            DataRequired('Por favor, informe o seu nome.'),
            Length(2, 20, 'Seu nome deve ter entre %(min)d e %(max)d caracteres.'),
        ]
    )
    last_name = StringField(
        'Sobrenome',
        [
            DataRequired('Por favor, informe o seu sobrenome.'),
            Length(2, 20, 'Seu sobrenome deve ter entre %(min)d e %(max)d caracteres.'),
        ]
    )
    birthday = DateField(
        'Data de Nascimento',
        [
            DataRequired('Por favor, informe a data do seu nascimento.'),
        ]
    )
    genre = SelectField(
        'Gênero',
        [
            DataRequired('Por favor, selecione o seu gênero.'),
        ],
        choices=[
            ('man', 'Homem Cis'),
            ('woman', 'Mulher Cis'),
            ('intersex', 'Intersexual'),
            ('transwoman', 'Mulher Trans'),
            ('transman', 'Homem Trans'),
            ('trans', 'Travesti'),
            ('nb', 'Não Binário'),
        ],
        render_kw={'placeholder': 'Selecione seu gênero...'}
    )
    orientation = SelectField(
        'Orientação Sexual',
        [
            DataRequired('Por favor, selecione a sua orientação sexual.'),
        ],
        choices=[
            ('hetero', 'Heterossexual'),
            ('asex', 'Assexual'),
            ('gay', 'Gay'),
            ('lesb', 'Lésbica'),
            ('bisex', 'Bissexual'),
            ('pansex', 'Pansexual'),
            ('polisex', 'Polissexual'),
        ],
        default='Selecione sua orientação...'
    )
    phone = TelField(
        'Celular',
        [
            DataRequired('Por favor, informe um número de celular válido.'),
            Length(11, 11, message='Número máximo de %(max)d caracteres excedido.'),
        ],
        description='Informe apenas os números do DDD e celular.'
    )
Exemple #17
0
class EditActivityForm(FlaskForm):
    activitytype = SelectField('Activity:',
                               validators=[DataRequired()],
                               coerce=int)
    date = DateField(label='Date:')
    submit = SubmitField('Save')
Exemple #18
0
class NoticeForm(Form):
    """ Edit an official notice.

    The issues are limited according to the deadline (or the issue date in the
    for publishers) and the categories and organizations are limited to the
    active one.

    """

    title = StringField(
        label=_("Title (maximum 60 characters)"),
        validators=[InputRequired(),
                    DataRequired(),
                    Length(max=60)],
        render_kw={'maxlength': 60},
    )

    organization = ChosenSelectField(label=_("Organization"),
                                     choices=[],
                                     validators=[InputRequired()])

    category = ChosenSelectField(label=_("Category"),
                                 choices=[],
                                 validators=[InputRequired()])

    print_only = BooleanField(label=_("Print only"), default=False)

    at_cost = RadioField(label=_("Liable to pay costs"),
                         default='no',
                         choices=[('no', _("No")), ('yes', _("Yes"))])

    billing_address = TextAreaField(label=_("Billing address"),
                                    render_kw={'rows': 3},
                                    depends_on=('at_cost', 'yes'),
                                    validators=[
                                        InputRequired(),
                                        DataRequired(),
                                    ])

    issues = MultiCheckboxField(label=_("Issue(s)"),
                                choices=[],
                                validators=[InputRequired()])

    text = QuillField(label=_("Text"),
                      tags=('strong', 'ol', 'ul'),
                      validators=[
                          InputRequired(),
                          HtmlDataRequired(),
                      ])

    author_place = StringField(label=_("Place"),
                               validators=[
                                   InputRequired(),
                                   DataRequired(),
                               ])

    author_date = DateField(label=_("Date (usually the date of the issue)"),
                            validators=[InputRequired()])

    phone_number = PhoneNumberField(
        label=_("Phone number for enquiry"),
        description="+41791112233",
    )

    author_name = TextAreaField(
        label=_("Author"),
        validators=[
            InputRequired(),
            DataRequired(),
        ],
        render_kw={'rows': 4},
    )

    @property
    def author_date_utc(self):
        if self.author_date.data:
            return standardize_date(as_datetime(self.author_date.data), 'UTC')
        return None

    def on_request(self):
        session = self.request.session

        # populate organization (active root elements with no children or
        # active children (but not their parents))
        self.organization.choices = []
        self.organization.choices.append(
            ('', self.request.translate(_("Select one"))))
        query = session.query(Organization)
        query = query.filter(Organization.active.is_(True))
        query = query.filter(Organization.parent_id.is_(None))
        query = query.order_by(Organization.order)
        for root in query:
            if root.children:
                for child in root.children:
                    if child.active:
                        self.organization.choices.append(
                            (child.name, child.title))
            else:
                self.organization.choices.append((root.name, root.title))

        # populate categories
        query = session.query(Category.name, Category.title)
        query = query.filter(Category.active.is_(True))
        query = query.order_by(Category.order)
        self.category.choices = query.all()

        # populate issues
        now = utcnow()
        layout = Layout(None, self.request)

        self.issues.choices = []
        query = session.query(Issue)
        query = query.order_by(Issue.date)
        if self.request.is_private(self.model):
            query = query.filter(date.today() < Issue.date)  # publisher
        else:
            query = query.filter(now < Issue.deadline)  # editor
        for issue in query:
            self.issues.choices.append(
                (issue.name,
                 layout.format_issue(issue, date_format='date_with_weekday')))
            if now >= issue.deadline:
                self.issues.render_kw['data-hot-issue'] = issue.name

        # Remove the print only option if not publisher
        if not self.request.is_private(self.model):
            self.delete_field('print_only')

    def update_model(self, model):
        model.title = self.title.data
        model.organization_id = self.organization.data
        model.category_id = self.category.data
        model.text = self.text.data
        model.author_place = self.author_place.data
        model.author_date = self.author_date_utc
        model.author_name = self.author_name.data
        model.at_cost = self.at_cost.data == 'yes'
        model.billing_address = self.billing_address.data
        model.issues = self.issues.data
        if self.print_only:
            model.print_only = self.print_only.data
        if self.phone_number.data and model.user:
            model.user.phone_number = self.phone_number.formatted_data
        model.apply_meta(self.request.session)

    def apply_model(self, model):
        self.title.data = model.title
        self.organization.data = model.organization_id
        self.category.data = model.category_id
        self.text.data = model.text
        self.author_place.data = model.author_place
        self.author_date.data = model.author_date
        self.author_name.data = model.author_name
        self.at_cost.data = 'yes' if model.at_cost else 'no'
        self.billing_address.data = model.billing_address or ''
        self.issues.data = list(model.issues.keys())
        if model.user:
            self.phone_number.data = model.user.phone_number
        if self.print_only:
            self.print_only.data = True if model.print_only else False
Exemple #19
0
class CompleteOrderForm(FlaskForm):
    number=IntegerField('Unit')
    order_date = DateField('Pick up Date',validators=[DataRequired()])
    submit = SubmitField('Complete order')
Exemple #20
0
class FormTanggal(FlaskForm):
    sarpelkes = StringField('Sarpelkes', validators=[DataRequired()])
    nomorwo = StringField('No.WO', validators=[DataRequired()])
    tgl_kirim = DateField('Tanggal Kirim', validators=[DataRequired()])
    submit = SubmitField('Update')
Exemple #21
0
class RemoveFood(FlaskForm):
    type = StringField('Name',validators=[DataRequired()])
    exp_data = DateField('Expired Data')
    pointfds = StringField('Point')
    quantity = IntegerField('Unit',validators=[DataRequired()])
    submit = SubmitField('Remove')
class SearchForm(FlaskForm):
    vacation_start = DateField('Start Date', format='%Y-%m-%d')
    vacation_end = DateField('End Date', format='%Y-%m-%d')
    search = SubmitField('Search')
Exemple #23
0
class AddOfficerForm(Form):
    department = QuerySelectField('Department',
                                  validators=[DataRequired()],
                                  query_factory=dept_choices,
                                  get_label='name')
    first_name = StringField(
        'First name',
        default='',
        validators=[Regexp(r'\w*'), Length(max=50),
                    Optional()])
    last_name = StringField(
        'Last name',
        default='',
        validators=[Regexp(r'\w*'),
                    Length(max=50),
                    DataRequired()])
    middle_initial = StringField(
        'Middle initial',
        default='',
        validators=[Regexp(r'\w*'), Length(max=50),
                    Optional()])
    suffix = SelectField('Suffix',
                         default='',
                         choices=SUFFIX_CHOICES,
                         validators=[AnyOf(allowed_values(SUFFIX_CHOICES))])
    race = SelectField('Race',
                       default='WHITE',
                       choices=RACE_CHOICES,
                       validators=[AnyOf(allowed_values(RACE_CHOICES))])
    gender = SelectField('Gender',
                         default='M',
                         choices=GENDER_CHOICES,
                         validators=[AnyOf(allowed_values(GENDER_CHOICES))])
    star_no = StringField('Badge Number',
                          default='',
                          validators=[Regexp(r'\w*'),
                                      Length(max=50)])
    unique_internal_identifier = StringField(
        'Unique Internal Identifier',
        default='',
        validators=[Regexp(r'\w*'), Length(max=50)])
    job_id = StringField('Job ID')  # Gets rewritten by Javascript
    unit = QuerySelectField('Unit',
                            validators=[Optional()],
                            query_factory=unit_choices,
                            get_label='descrip',
                            allow_blank=True,
                            blank_text=u'None')
    employment_date = DateField('Employment Date', validators=[Optional()])
    birth_year = IntegerField('Birth Year', validators=[Optional()])
    links = FieldList(
        FormField(LinkForm, widget=FormFieldWidget()),
        description='Links to articles about or videos of the incident.',
        min_entries=1,
        widget=BootstrapListWidget())
    notes = FieldList(
        FormField(BaseTextForm, widget=FormFieldWidget()),
        description=
        'This note about the officer will be attributed to your username.',
        min_entries=1,
        widget=BootstrapListWidget())
    descriptions = FieldList(
        FormField(BaseTextForm, widget=FormFieldWidget()),
        description=
        'This description of the officer will be attributed to your username.',
        min_entries=1,
        widget=BootstrapListWidget())
    salaries = FieldList(FormField(SalaryForm, widget=FormFieldWidget()),
                         description='Officer salaries',
                         min_entries=1,
                         widget=BootstrapListWidget())

    submit = SubmitField(label='Add')
Exemple #24
0
class LeaveForm(FlaskForm):
    dt = DateField('Leave From')
    dt1 = DateField('Leave To')
    submit = SubmitField('Apply')
Exemple #25
0
class DateForm(FlaskForm):
    date = DateField('Choose a date')
    submitDate = SubmitField('Submit')
Exemple #26
0
class TimeForm(FlaskForm):
    Date = DateField('Date', validators=[DataRequired()])
Exemple #27
0
class BiopsyForm(SectionForm):
    def get_summary(self):
        return self.fld_biopsy_tumour_diagnosis.data

    fld_block_serial_number_biopsy = StringField(
        'Block Serial Number', [validators.Length(min=1, max=50)], default=tbd)
    fld_block_location_biopsy = StringField(
        "Block Location ID (Cabinet No.-Drawer No.-Column No.-Front/Back",
        default='To be Filled')
    fld_block_current_location_biopsy = StringField(
        "Current location of block", default=tbd)
    fld_reason_for_biopsy = SelectField(
        "Reason for biopsy", choices=BiopsyDict.biopsy_reason_choice)
    fld_reason_for_biopsy_other = StringField("Give details")

    fld_biopsy_site = SelectField("Site of biopsy",
                                  choices=BiopsyDict.biopsy_site_choice)
    fld_biopsy_site_other = StringField("Other")
    fld_biopsy_custody_pccm = SelectField(
        'Is the biopsy report in PCCM custody?',
        choices=BiopsyDict.biopsy_custody_pccm_choice
    )  #is this the cjoice as mentioned or yes/no?
    fld_biopsy_custody_pccm_other = StringField("Other")
    fld_block_received_pccm_date = DateField(
        "Date when block was placed in the cabinet", default=date.today())
    fld_biopsy_ihc_report_pccm = SelectField(
        "Biopsy IHC report in PCCM custody", choices=CommonDict.yes_no_choice)
    fld_biopsy_block_id = StringField("Biopsy Block ID",
                                      default=tbd)  #major doubt
    fld_biopsy_block_id_other = StringField("other")
    fld_biopsy_no_of_blocks = IntegerField("Number of blocks", default=tbd)
    fld_biopsy_date = DateField("Date of Biopsy", default=date.today())
    fld_biopsy_block_source = SelectField(
        "Reports have been generated from",
        choices=BiopsyDict.biopsy_block_source_choice)
    fld_biopsy_block_source_other = StringField("Give details")
    fld_biopsy_lab_id_sid = StringField("Biopsy Lab ID", default=tbd)
    fld_biopsy_type = SelectField("Biopsy Type",
                                  choices=BiopsyDict.biopsy_type_choice)
    fld_biopsy_type_other = StringField("Other")
    fld_biopsy_diagnosis = TextAreaField(
        'Mention the diagnosis in its fullform.'
        ' Eg: Infiltrating Duct Carcinoma/Invasive Mammary Carcinoma/ DCIS/Fibroadenoma; '
        'Infiltrating Duct Carcinoma + DCIS',
        default=tbd)
    fld_biopsy_diagnosis_comment = StringField(
        "Include descriptive or indicative notes here and not in Diagnosis",
        default=tbd)
    fld_biopsy_tumour_grade = SelectField(
        "Tumour Grade", choices=BiopsyDict.tumour_grade_choice)
    fld_biopsy_tumour_grade_other = StringField("Give details")
    fld_biopsy_lymphovascular_emboli = SelectField(
        'Are Lymphovascular emboli seen?',
        choices=BiopsyDict.lymphovascular_emboli_choice)
    fld_biopsy_lymphovascular_emboli_other = StringField("Other")
    fld_dcis_biopsy = SelectField("Does the biopsy show DCIS",
                                  choices=BiopsyDict.dcis_biopsy_choice)
    fld_dcis_biopsy_other = StringField("Other")
    fld_tumour_er_biopsy = SelectField("Biopsy block ER Status",
                                       choices=BiopsyDict.tumour_er_choice)
    fld_tumour_er_biopsy_other = StringField("Other")
    fld_tumour_er_percent_biopsy = StringField("ER Percent", default=tbd)
    fld_tumour_pr_biopsy = SelectField("Biopsy block PR Status",
                                       choices=BiopsyDict.tumour_pr_choice)
    fld_tumour_pr_biopsy_other = StringField("Other")
    fld_tumour_pr_percent_biopsy = StringField("PR Percent", default=tbd)
    fld_tumour_her2_biopsy = SelectField("Biopsy block HER2 Status",
                                         choices=BiopsyDict.tumour_her2_choice)
    fld_tumour_her2_biopsy_other = StringField("Other")
    fld_tumour_her2_grade_biopsy = StringField("HER2 Grade", default=tbd)
    fld_tumor_biopsy_fish = SelectField(
        "Tumor biopsy FISH", choices=BiopsyDict.tumor_biopsy_fish_choice)
    fld_tumor_biopsy_fish_other = StringField("Other")
    fld_tumour_ki67_biopsy = StringField("Ki67 Percent", default=tbd)
    fld_fnac = SelectField("Lymph Node biopsy FNAC",
                           choices=BiopsyDict.fnac_choice)
    fld_fnac_other = StringField("Other")
    fld_fnac_location = SelectField("FNAC Location",
                                    choices=BiopsyDict.fnac_location_choice)
    fld_fnac_location_other = StringField("Other")
    fld_fnac_diagnosis = SelectField("FNAC Diagnosis",
                                     choices=BiopsyDict.fnac_diagnosis_choice)
    fld_fnac_diagnosis_other = StringField("Other")
    fld_surgery_form_present = SelectField("Is surgery performed?",
                                           choices=CommonDict.yes_no_choice)
    surgery_form = FormField(SurgeryBlockForm)
    submit_button = SubmitField('Submit Form')
Exemple #28
0
class FilmScheduleForm(Form):
    Room = StringField('Room', validators=[DataRequired()])
    Date = DateField('Date', validators=[DataRequired()])
    Time = StringField('Time', validators=[DataRequired()])
    Price = StringField('Price', validators=[DataRequired()])
    submit = SubmitField('Submit')
Exemple #29
0
class ExampleForm(Form):
    dt = DateField('DatePicker', format='%Y-%m-%d')
    submit = SubmitField()
Exemple #30
0
class CustomerBlockForm(BaseForm):
    date_end = DateField(
        "Eston loppumisaika",
        format="%Y-%m-%d",
        validators=[DataRequired(message="Päivämäärä ei voi olla tyhjä")])