コード例 #1
0
class UpdateProfileForm(Form):
    id = IntegerField(label=None, widget=HiddenInput())
    fullname = TextField('Full name', [
        validators.Length(
            min=3,
            max=35,
            message="Full name must be between 3 and 35 characters long")
    ])
    name = TextField('User name', [
        validators.Length(
            min=3,
            max=35,
            message="User name must be between 3 and 35 characters long"),
        Unique(model.Session,
               model.User,
               model.User.name,
               message="The user name is already taken")
    ])
    email_addr = TextField('Email Address', [
        validators.Length(
            min=3,
            max=35,
            message="Email must be between 3 and 35 characters long"),
        validators.Email(),
        Unique(model.Session,
               model.User,
               model.User.email_addr,
               message="Email is already taken")
    ])
コード例 #2
0
class RegisterForm(Form):
    fullname = TextField('Full name', [
        validators.Length(
            min=3,
            max=35,
            message="Full name must be between 3 and 35 characters long")
    ])
    username = TextField('User name', [
        validators.Length(
            min=3,
            max=35,
            message="User name must be between 3 and 35 characters long"),
        Unique(model.Session,
               model.User,
               model.User.name,
               message="The user name is already taken")
    ])
    email_addr = TextField('Email Address', [
        validators.Length(
            min=3,
            max=35,
            message="Email must be between 3 and 35 characters long"),
        validators.Email(),
        Unique(model.Session,
               model.User,
               model.User.email_addr,
               message="Email is already taken")
    ])
    password = PasswordField('New Password', [
        validators.Required(message="Password cannot be empty"),
        validators.EqualTo('confirm', message='Passwords must match')
    ])
    confirm = PasswordField('Repeat Password')
コード例 #3
0
ファイル: applications.py プロジェクト: jun9/pybossa
class AppForm(Form):
    id = IntegerField(label=None, widget=HiddenInput())
    name = TextField('Name', [
        validators.Required(),
        Unique(model.Session,
               model.App,
               model.App.name,
               message="Name is already taken.")
    ])
    short_name = TextField('Short Name', [
        validators.Required(),
        Unique(model.Session,
               model.App,
               model.App.short_name,
               message="Short Name is already taken.")
    ])
    description = TextField(
        'Description',
        [validators.Required(message="You must provide a description.")])
    hidden = BooleanField('Hide?')