class TellUsAboutContractForm(FlaskForm):
    INVALID_VALUE_MESSAGE = "Enter the value in pounds and pence, using numbers and decimals"

    start_date = DMDateField(
        "Start date",
        validators=[
            DateValidator("the start date"),
        ],
    )

    end_date = DMDateField(
        "End date",
        validators=[
            DateValidator("the end date"),
            GreaterThan("start_date", "End date must be after the start date"),
        ],
    )

    value_in_pounds = DMPoundsField(
        "Value",
        validators=[
            InputRequired("Enter the contract value"),
            DataRequired(INVALID_VALUE_MESSAGE),
            NumberRange(min=Decimal('0.01'), message=INVALID_VALUE_MESSAGE),
        ],
    )

    buying_organisation = DMStripWhitespaceStringField(
        "Organisation buying the service",
        hint="For example, National Audit Office or Lewisham Council",
        validators=[
            InputRequired("Enter an organisation")
        ],
    )
コード例 #2
0
 class TestForm(wtforms.Form):
     start_date = DMDateField("Start date")
     end_date = DMDateField("End date", validators=[GreaterThan("start_date")])
コード例 #3
0
 class TestForm(wtforms.Form):
     field = DMDateField(validators=[DateValidator("a date")])
コード例 #4
0
 class TestForm(wtforms.Form):
     date = DMDateField("Date", validators=[DateValidator("a date")])
コード例 #5
0
 class TestForm(wtforms.Form):
     field = DMDateField()
コード例 #6
0
 class TestForm(wtforms.Form):
     date = DMDateField("Date", validators=[test_validator])
コード例 #7
0
 class TestForm(wtforms.Form):
     date = DMDateField("Date")
def test_create_date_field_with_validators():
    assert DMDateField(validators=[InputRequired(), DataRequired()])
 class DateForm(Form):
     date = DMDateField(validators=[FourDigitYear()])
 class DateForm(Form):
     past = DMDateField()
     date = DMDateField(validators=[GreaterThan('invalid_key')])
 class DateForm(Form):
     date = DMDateField(validators=[DataRequired()])
 class DateForm(Form):
     date = DMDateField(validators=[InputRequired(), DataRequired(message)])
class DateForm(Form):
    date = DMDateField()