from wtforms import Form, BooleanField, TextField, PasswordField, SelectField, validators from mg import pool class BackupForm(Form): backup_name = TextField(u'Backup Name', [validators.Length(min=2, max=25), validators.Required()]) class CreateDistForm(Form): dist_name = TextField(u'Distributive Name', [validators.Length(min=2, max=25), validators.Required()]) class InstallForm(Form): store_name = TextField(u'Store Name', [validators.Length(min=2, max=25), validators.Required()]) magento_version = SelectField(u'Magento Version', choices=[]) sample_data_version = SelectField(u'Install Sample Data', choices=[('', 'No'), ('latest', 'Yes')]) def refresh(self, m): self.magento_version.choices = [ (v, v) for v in m.pool.list_local(pool.dists) ] self.magento_version.choices.sort() class StoreSetAdminLogin(Form): login = TextField(u'Login', [validators.Length(min=2, max=25), validators.Required()]) password = PasswordField(u'Password', [validators.Length(min=2, max=25), validators.Required()])