Пример #1
0
class FormCreate(DBForm):
    name = "create"
    string = _('Create new database')
    action = '/database/do_create'
    submit_text = _('OK')
    strip_name = True
    form_attrs = {'onsubmit': 'return on_create()'}
    fields = [
        widgets.PasswordField(name='password',
                              label=_('Super admin password:'******'dbname',
                          label=_('New database name:'),
                          validator=validators.NotEmpty()),
        widgets.CheckBox(name='demo_data',
                         label=_('Load Demonstration data:'),
                         default=True,
                         validator=validators.Bool(if_empty=False)),
        widgets.SelectField(name='language',
                            options=get_lang_list,
                            validator=validators.String(),
                            label=_('Default Language:')),
        widgets.PasswordField(name='admin_password',
                              label=_('Administrator password:'******'confirm_password',
                              label=_('Confirm password:'),
                              validator=validators.NotEmpty())
    ]
    validator = validators.Schema(chained_validators=[
        validators.FieldsMatch("admin_password", "confirm_password")
    ])
Пример #2
0
class FormRestore(DBForm):
    name = "restore"
    string = _('Restore database')
    action = '/database/do_restore'
    submit_text = _('OK')
    fields = [
        widgets.FileField(name="filename", label=_('File:')),
        widgets.PasswordField(name='password',
                              label=_('Password:'******'dbname',
                          label=_('New database name:'),
                          validator=validators.NotEmpty())
    ]
Пример #3
0
class FormPassword(DBForm):
    name = "password"
    string = _('Change Administrator Password')
    action = '/database/do_password'
    submit_text = _('OK')
    fields = [
        widgets.PasswordField(name='old_password',
                              label=_('Old Password:'******'new_password',
                              label=_('New Password:'******'confirm_password',
                              label=_('Confirm Password:'),
                              validator=validators.NotEmpty())
    ]

    validator = validators.Schema(chained_validators=[
        validators.FieldsMatch("new_password", "confirm_password")
    ])
Пример #4
0
class FormBackup(DBForm):
    name = "backup"
    string = _('Backup database')
    action = '/database/do_backup'
    submit_text = _('OK')
    fields = [
        widgets.SelectField(name='dbname',
                            options=get_db_list,
                            label=_('Database:'),
                            validator=validators.String(not_empty=True)),
        widgets.PasswordField(name='password',
                              label=_('Password:'),
                              validator=validators.NotEmpty())
    ]
Пример #5
0
class FormDrop(DBForm):
    name = "drop"
    string = _('Drop database')
    action = '/database/do_drop'
    submit_text = _('OK')
    form_attrs = {
        'onsubmit':
        'return window.confirm("%s")' %
        _("Do you really want to drop the selected database?")
    }
    fields = [
        widgets.SelectField(name='dbname',
                            options=get_db_list,
                            label=_('Database:'),
                            validator=validators.String(not_empty=True)),
        widgets.PasswordField(name='password',
                              label=_('Password:'),
                              validator=validators.NotEmpty())
    ]