Ejemplo n.º 1
0
class SignupForm(BaseForm):
    id="signup"
    label = "Create account"
    action_label = "Create account"
    fields = [
        StringField("name", "Name", REQUIRED)
        , EmailField("email", "Email", HtmlAttrs(required = True, data_validation_url = '/signup/checkemail'))
        , PasswordField("pwd", "Password", REQUIRED)
        , PasswordField("pwdconfirm", "Retype password", REQUIRED)
        , CheckboxPostField("agreeTOS", 'I accept the <a class="link" target="_blank" href="/terms">terms of use</a> and <a class="link" target="_blank" href="/privacy">privacy statement</a>', REQUIRED)
    ]
    chained_validators = [formencode.validators.FieldsMatch('pwd', 'pwdconfirm')]
    @classmethod
    def on_success(cls, request, values):
        try:
            user = SignupProc(request, values)
        except DBMessage, e:
            if e.message == 'EMAIL_TAKEN':
                return {'success':False, 'errors':{'email': "Email already registered!"}}
            else:
                return {'success':False, 'errors':{'email': e.message}}
        return {'success':True, 'redirect':request.fwd_url("website_index_member")}
Ejemplo n.º 2
0
class CooperationForm(MultipleFormField):
    fields = [
        ConfigTypeAheadField('type', "Type of Cooperation", "CooperationType"),
        StringField("comment",
                    "Name of cooperation / Comment",
                    label_classes="double"),
        StringField("year", "Year"),
        StringField("institution", "Name of institution"),
        URLField("website", "Website"),
        PlainHeadingField("Location", tag="h5", classes="controls"),
        TokenTypeAheadField('Country', 'Country', '/admin/search/address',
                            'AddressSearchResult', None),
        TokenTypeAheadField('Region', 'Region', '/admin/search/address',
                            'AddressSearchResult', 'Country'),
        TokenTypeAheadField('City', 'City', '/admin/search/address',
                            'AddressSearchResult', 'Country Region'),
        StringField('postCode', 'Post Code'),
        StringField('line1', 'Street 1'),
        StringField('line2', 'Street 2'),
        StringField('line3', 'Street 3')
    ]
Ejemplo n.º 3
0
class NewsItemForm(MultipleFormField):
    fields = [
        TextareaField("value", "Text", input_classes="span8 input-xxlarge"),
        StringField("source", "Source", input_classes="span8"),
        HiddenField("created")
    ]
class UniversityForm(MultipleFormField):
    fields = [
        StringField('name', 'Name of University')
        , StringField('city', 'City')
    ]
    fields = [
        RestrictedCountryField('Country', 'Country', '/admin/search/address', 'AddressSearchResult', None, REQUIRED)
        , TokenTypeAheadField('Region', 'Region', '/admin/search/address', 'AddressSearchResult', 'Country')
        , TokenTypeAheadField('City', 'City', '/admin/search/address', 'AddressSearchResult', 'Country Region', REQUIRED)
        , StringField('postCode', 'Post Code')
        , StringField('line1', 'Street 1')
        , StringField('line2', 'Street 2')
        , StringField('line3', 'Street 3')
    ]
class UniversityForm(MultipleFormField):
    fields = [
        StringField('name', 'Name of University')
        , StringField('city', 'City')
    ]
collectorCreateFields = [
        StringField('firstName', 'First Name', REQUIRED)
        , StringField('lastName', 'Last Name', REQUIRED)
        , StringField('origName', 'Name in orig. Language')
        , ConfigChoiceField('title', 'Title', 'Title', IMPORTANT)
        , StringField('dob', 'Born', IMPORTANT)
        , ConfigChoiceField('gender', 'Gender', 'Gender', IMPORTANT)
        , ConfigChoiceField('nationality', 'Nationality', 'Nationality', IMPORTANT)
        , PictureUploadField('picture', 'Picture', attrs = PictureUploadAttrs())
        , AddressForm('Address', 'Location')
        , UniversityForm('University', classes = 'form-embedded-wrapper form-inline')
        , PlainHeadingField("Areas of Interest")
        , TagSearchField('Interest', "Interest", "/admin/search/interest", "Interest", api_allow_new = True, classes='tagsearch input-xxlarge')
    ]


Ejemplo n.º 6
0
class PublicationsForm(MultipleFormField):
    fields = [
        StringField('title', "Title"),
        ConfigTypeAheadField('publisher', 'Publisher', 'Publisher'),
        IntField('year', "Year")
    ]
Ejemplo n.º 7
0
from larryslist.lib.formlib.formfields import IntField, IMPORTANT, StringField, ApproxField, HiddenField, MultipleFormField, PlainHeadingField, ConfigChoiceField, URLField, TagSearchField, BaseSchema, Placeholder, TokenTypeAheadField, EmailField, ConfigTypeAheadField

__author__ = 'Martin'

baseCollectionFields = [
    ApproxField('totalWorks',
                'totalWorksAprx',
                "Total number of artworks in collection",
                IMPORTANT,
                label_classes="double"),
    ApproxField('totalArtists',
                'totalArtistsAprx',
                "Total number of artists in collection",
                IMPORTANT,
                label_classes="double"),
    StringField("name", "Name of collection", IMPORTANT),
    StringField("foundation", "Name of foundation"),
    IntField('started', "Started collecting in year"),
    PlainHeadingField("Themes in collection"),
    TagSearchField('Theme',
                   "Tags",
                   "/admin/search/theme",
                   "Theme",
                   api_allow_new=True,
                   classes='tagsearch input-xxlarge'),
    PlainHeadingField("Art Genre / Movement"),
    TagSearchField('Genre',
                   "Genre",
                   "/admin/search/genre",
                   "Genre",
                   api_allow_new=False,