def get_site_settings_form(): form = zoom.forms.Form( f.Section('Site', [ f.TextField('Name', v.required), f.TextField('Owner Name'), f.EmailField('Owner Email'), f.URLField('Owner URL'), f.EmailField('Register Email'), f.EmailField('Support Email'), ]), f.ButtonField('Save') ) form.update(zoom.system.site.settings.site) return form
def profile_fields(): """Return Profile Fields""" return f.Fields([ f.Section('Basic', [ f.TextField('First Name', v.required), f.TextField('Last Name', v.required), f.TextField('Username', v.required, size=15), f.EmailField('Email'), f.PhoneField('Phone'), f.TextField('City', size=20), f.BasicImageField('Photo'), ]), f.Section('Locale', [ f.TimezoneField('Timezone', default='Canada/Pacific'), ]), f.Section('Social', [ f.TextField('Web'), f.TextField('Blog'), f.TextField('Twitter',size=20), ]), f.Section('Bio', [ f.MemoField('About You', cols=40, name="about"), ]), ])
def get_fields(): """Return registration form fields""" return f.Fields([ f.Section('First, the basics', [ f.TextField('First Name', v.required, v.valid_name, maxlength=40, placeholder='First Name'), f.TextField( 'Last Name', v.required, maxlength=40, placeholder="Last Name"), f.EmailField('Email', v.required, v.valid_email, maxlength=60, placeholder='Email'), ]), f.Section( 'Next, choose a username and password', [ f.TextField( 'Username', v.required, v.valid_username, # v.name_available, maxlength=50, size=30), f.PasswordField('Password', v.required, v.valid_password, maxlength=16, size=20), f.PasswordField('Confirm', v.required, maxlength=16, size=20), ]), ])
def get_mail_settings_form(): """Creates, initializes and returns the mail settings form""" form = zoom.forms.Form( f.Section('Mail', [ f.TextField('SMTP Host'), f.IntegerField('SMTP Port', size=4, default=3309), f.TextField('SMTP User'), f.TextField('SMTP Password', name='smtp_password'), f.URLField('Logo'), f.EmailField('From Address', name='from_addr'), f.TextField('From Name', name='from_name'), f.PulldownField('Delivery', options=['immediate', 'background']) ]), f.ButtonField('Save') ) form.update(zoom.system.site.settings.mail) return form
def get_theme_settings_form(): form = zoom.forms.Form( f.Section('Theme',[ f.PulldownField( 'Name', name='theme_name', options=get_theme_options() ), # f.TextField('Template', name='theme_template'), f.PulldownField( 'Comments', name='theme_comments', options=theme_comment_options ) ]), f.ButtonField('Save') ) form.update(zoom.system.site.settings.theme) return form
from zoom import __version__ from zoom.mvc import View from zoom.page import page from zoom.tools import load_content from zoom.browse import browse import zoom.fields as f from zoom.validators import required import widgets my_form = f.Fields( f.Section('Personal', [ f.TextField( 'Name', required, size=20, value='John Doe', hint='this is a hint'), f.MemoField('Notes', hint='this is a hint'), ]), f.Section('Social', [ f.TextField('Twitter', size=15, value='jdoe', hint='optional'), ]), f.ButtonField('Save'), ) small_form = f.Fields( f.TextField("Name", size=20), f.TextField("Address"), ) class MyView(View): """main application view"""