Esempio n. 1
0
class BuyerSignupForm(DmForm):
    employment_status = RadioField(
        label=
        'I am a public service employee or have authorisation, as described above.',
        choices=[
            ('employee',
             'I am an employee under the Commonwealth Public Service Act (1999) or under equivalent state or territory legislation and need access to the Digital Marketplace to perform my role.'
             ),  # noqa
            ('contractor',
             'I am a contractor working in local, state or federal government.'
             ),
        ],
        default='',
        validators=[
            DataRequired(message='You must specify your employment status')
        ])

    name = StripWhitespaceStringField(
        'Your full name',
        id='name',
        validators=[
            DataRequired(message='You must provide your full name'),
        ])

    email_address = StripWhitespaceStringField(
        'Email',
        id="input_email_address",
        validators=[
            DataRequired(message='You must provide an email address'),
            government_email_validator,
        ])
Esempio n. 2
0
class FormForTest(DmForm):
    stripped_field = StripWhitespaceStringField('Stripped',
                                                id='stripped_field')
    buyer_email = StripWhitespaceStringField('Buyer email address',
                                             id='buyer_email',
                                             validators=[
                                                 government_email_validator,
                                             ])
Esempio n. 3
0
class EditSupplierForm(Form):
    description = StripWhitespaceStringField('Supplier summary', validators=[
        word_length(50, 'Your summary must not be more than %d words')
    ])
    clients = FieldList(StripWhitespaceStringField())

    def validate_clients(form, field):
        if len(field.data) > 10:
            raise ValidationError('You must have 10 or fewer clients')
Esempio n. 4
0
class InviteForm(DmForm):
    name = StripWhitespaceStringField(
        'Name', validators=[
            DataRequired(message="Name cannot be empty"),
        ])

    email_address = StripWhitespaceStringField(
        'Email address',
        validators=[
            DataRequired(message="Email cannot be empty"),
            Email(message="Please enter a valid email address")
        ])
class EditContactInformationForm(DmForm):
    phone = StripWhitespaceStringField('Phone number')
    email = StripWhitespaceStringField(
        'Email address',
        validators=[
            DataRequired(message="You must provide an email address"),
            Email(message="Please enter a valid email address")
        ])
    name = StripWhitespaceStringField(
        'Contact name',
        validators=[
            DataRequired(message="You must provide a contact name"),
        ])
Esempio n. 6
0
class CompanyContactDetailsForm(Form):
    contact_name = StripWhitespaceStringField('Contact name', validators=[
        DataRequired(message="You must provide a contact name."),
        Length(max=255, message="You must provide a contact name under 256 characters.")
    ])
    email_address = StripWhitespaceStringField('Email address', validators=[
        DataRequired(message="You must provide a email address."),
        Email(message="You must provide a valid email address.")
    ])
    phone_number = StripWhitespaceStringField('Phone number', validators=[
        DataRequired(message="You must provide a phone number."),
        Length(max=20, message="You must provide a phone number under 20 characters.")
    ])
Esempio n. 7
0
class MoveUserForm(DmForm):
    user_to_move_email_address = StripWhitespaceStringField(
        'Move an existing user to this supplier',
        validators=[
            DataRequired(message="Email can not be empty"),
            Email(message="Please enter a valid email address")
        ])
class EmailAddressForm(DmForm):
    email_address = StripWhitespaceStringField(
        'Email address',
        validators=[
            DataRequired(message="You must provide a email address."),
            Email(message="You must provide a valid email address.")
        ])
Esempio n. 9
0
class BuyerInviteRequestForm(BuyerSignupForm):

    manager_name = StripWhitespaceStringField(
        'Manager name',
        id='manager_name',
        validators=[
            DataRequired(message='You must provide the name of your manager'),
        ])

    manager_email = StripWhitespaceStringField(
        'Manager email address',
        id='manager_email',
        validators=[
            DataRequired(
                message='You must provide your manager\'s email address'),
            government_email_validator,
        ])
Esempio n. 10
0
class LoginForm(Form):
    email_address = StripWhitespaceStringField('Email address', validators=[
        DataRequired(message='Email cannot be empty'),
        Email(message='Please enter a valid email address')
    ])
    password = PasswordField('Password', validators=[
        DataRequired(message='Please enter your password')
    ])
Esempio n. 11
0
class EmailAddressForm(DmForm):
    email_address = StripWhitespaceStringField(
        'Email',
        id="input_email_address",
        validators=[
            DataRequired(message="You must provide an email address"),
            email_validator,
        ])
class DunsNumberForm(DmForm):
    duns_number = StripWhitespaceStringField(
        'DUNS Number',
        validators=[
            DataRequired(
                message="You must enter a DUNS number with 9 digits."),
            Regexp(r'^\d{9}$',
                   message="You must enter a DUNS number with 9 digits."),
        ])
class CompaniesHouseNumberForm(DmForm):
    companies_house_number = StripWhitespaceStringField(
        'Companies house number',
        validators=[
            Optional(),
            Length(min=8,
                   max=8,
                   message="Companies House numbers must have 8 characters.")
        ])
class CompanyNameForm(DmForm):
    company_name = StripWhitespaceStringField(
        'Company name',
        validators=[
            DataRequired(message="You must provide a company name."),
            Length(
                max=255,
                message="You must provide a company name under 256 characters."
            )
        ])
Esempio n. 15
0
class EditContactInformationForm(Form):
    id = IntegerField()
    address1 = StripWhitespaceStringField('Business address')
    address2 = StripWhitespaceStringField('Business address')
    city = StripWhitespaceStringField('Town or city')
    country = StripWhitespaceStringField()
    postcode = StripWhitespaceStringField()
    website = StripWhitespaceStringField()
    phoneNumber = StripWhitespaceStringField('Phone number')
    email = StripWhitespaceStringField('Email address', validators=[
        DataRequired(message="You must provide an email address"),
        Email(message="Please enter a valid email address")
    ])
    contactName = StripWhitespaceStringField('Contact name', validators=[
        DataRequired(message="You must provide a contact name"),
    ])
Esempio n. 16
0
def FormFactory(slug, formdata=None):
    class WorkOrderQuestionForm(DmForm):
        heading = questions[slug]['heading']
        summary = questions[slug]['summary']

    type = questions[slug].get('type', None)
    if type == 'text':
        setattr(
            WorkOrderQuestionForm, slug,
            StripWhitespaceStringField(
                questions[slug]['label'],
                validators=[DataRequired(message=questions[slug]['message'])]))
    elif type == 'address':
        setattr(
            WorkOrderQuestionForm, 'name',
            StripWhitespaceStringField(
                questions[slug]['nameLabel'],
                validators=[
                    DataRequired(message=questions[slug]['nameMessage'])
                ]))
        setattr(
            WorkOrderQuestionForm, 'contact',
            StripWhitespaceStringField(
                questions[slug]['contactLabel'],
                validators=[
                    DataRequired(message=questions[slug]['contactMessage'])
                ]))
        setattr(
            WorkOrderQuestionForm, 'abn',
            StripWhitespaceStringField(
                questions[slug]['abnLabel'],
                validators=[
                    DataRequired(message=questions[slug]['abnMessage'])
                ]))
    else:
        setattr(
            WorkOrderQuestionForm, slug,
            TextAreaField(
                questions[slug]['label'],
                validators=[DataRequired(message=questions[slug]['message'])]))

    return WorkOrderQuestionForm(formdata=formdata)
Esempio n. 17
0
class LoginForm(DmForm):
    email_address = StripWhitespaceStringField(
        'Email',
        id="input_email_address",
        validators=[
            DataRequired(message="You must provide an email address"),
            email_validator,
        ])
    password = PasswordField(
        'Password',
        id="input_password",
        validators=[DataRequired(message="You must provide your password")])
class SignerDetailsForm(Form):
    signerName = StripWhitespaceStringField(
        'Full name',
        validators=[
            DataRequired(
                message=
                "You must provide the full name of the person signing on behalf of the company."
            ),
            Length(max=255,
                   message="You must provide a name under 256 characters.")
        ])
    signerRole = StripWhitespaceStringField(
        'Role at the company',
        validators=[
            DataRequired(
                message=
                "You must provide the role of the person signing on behalf of the company."
            ),
            Length(max=255,
                   message="You must provide a role under 256 characters.")
        ],
        description=
        'The person signing must have the authority to agree to the framework terms, '
        'eg director or company secretary.')
Esempio n. 19
0
class CreateUserForm(DmForm):

    name = StripWhitespaceStringField(
        'Full name',
        id="input_name",
        validators=[
            DataRequired(message="You must enter a name"),
            Length(min=1,
                   max=255,
                   message="Names must be between 1 and 255 characters")
        ])

    password = PasswordField(
        'Password',
        id="input_password",
        validators=[
            DataRequired(message="You must enter a password"),
            Length(min=10,
                   max=50,
                   message="Passwords must be between 10 and 50 characters")
        ])

    accept = BooleanField(
        validators=[DataRequired(message="You must accept the Terms of Use")])
Esempio n. 20
0
class EmailAddressForm(Form):
    email_address = StripWhitespaceStringField('Email address', validators=[
        DataRequired(message="Email can not be empty"),
        Email(message="Please enter a valid email address")
    ])
class EditSupplierForm(DmForm):
    summary = StripWhitespaceStringField(
        'Supplier summary',
        validators=[
            word_length(50, 'Your summary must not be more than %d words')
        ])