Exemplo n.º 1
0
class AddPageForm(Form):
    date_added = fields.DateField('Publish On:',format="%m-%d-%Y",widget=DateWidget())
    date_end = fields.DateField('Expire On:',format="%m-%d-%Y",validators=[validators.Optional()],widget=DateWidget())
    name = fields.StringField('Page Name',validators=[validators.InputRequired()])
    description = fields.TextAreaField('Description',validators=[validators.Optional()])
    slug = fields.StringField('Page Slug',validators=[validators.InputRequired()])
    short_url = fields.StringField('Url',validators=[validators.Optional()])
    title = fields.StringField('Page Title',validators=[validators.InputRequired()])
    add_to_nav = fields.BooleanField('Add to Navbar')
    add_sidebar = fields.BooleanField('Add Sidebar')
    visible = fields.SelectField(choices=((1,'Publish'),(0,'Draft')))
    meta_title = fields.StringField('Meta Title',validators=[validators.InputRequired()])
    content = CodeMirrorField('Content',language='xml',config={'lineNumbers':'true'})
    template = fields.FormField(BaseTemplateForm,label="Template",separator='_')
    blocks = fields.SelectMultipleField(label="blocks",choices=[('a','a'),('b','b'),('c','c')])
    category = QuerySelectField('category')
    tags = TagField('Tags')
    use_base_template = fields.BooleanField('Use Base Template')
    base_template =  fields.SelectField(
                        'base template',validators=[
                            validators.InputRequired()
                        ],choices=[
                            (x,x) for x in sorted(get_page_templates()) \
                            if not x.startswith('_') and not \
                            x.startswith('.') and x.endswith('.html')
                        ]
    )
    submit = fields.SubmitField('Save')
Exemplo n.º 2
0
class EditProfileForm(Form):
    first_name = fields.StringField('First Name')
    last_name = fields.StringField('Last Name')
    email = fields.StringField(
        'Email Address',
        validators=[validators.Required(),
                    validators.Email()])
    phone_number = fields.StringField('phone number')
    birth_date = fields.DateField('Birth Date',
                                  format="%m-%d-%Y",
                                  validators=[validators.Optional()],
                                  widget=DateWidget())