class BaseEditForm(BaseForm): """Edit form with all missing fields except `content`""" # content_type = fields.PassiveStringField( # 'Type', # render_kw=READ_ONLY # ) # content_format = fields.PassiveStringField( # 'Format', # render_kw=READ_ONLY # ) tags = fields.Select2TagsField('Tags', save_as_list=True, render_kw=get_tags_kw) date = fields.DateTimeField('Date', [validators.required()], default=dt.datetime.now) modified = fields.HiddenField('Modified') slug = fields.StringField('Slug') language = fields.SmartSelect2Field( 'Language', choices=lambda: [(lng, lng) for lng in app.config.get('BABEL_LANGUAGES', ['en'])], default=get_default_language) # translations = fields.HiddenField('Translations') # todo: ^ create action 'add translation' published = fields.BooleanField('Status', render_kw={ 'data-toggle': "toggle", 'data-on': "Published", 'data-off': "Draft", "data-onstyle": 'success' }) comments = fields.BooleanField('Comments', default=True, render_kw={ 'data-toggle': "toggle", 'data-on': "Enabled", 'data-off': "Disabled", "data-onstyle": 'success' }) # to be used only for Block type block_items = InlineFieldList(InlineFormField(BlockItemForm), label='Items') custom_vars = InlineFieldList(InlineFormField(CustomVariablesForm), label='Custom Variables')
class BaseEditForm(BaseForm): """Edit form with all missing fields except `content`""" # content_type = fields.PassiveStringField( # 'Type', # render_kw=READ_ONLY # ) # content_format = fields.PassiveStringField( # 'Format', # render_kw=READ_ONLY # ) tags = fields.Select2TagsField('Tags', save_as_list=True, render_kw=get_tags_kw) date = fields.DateTimeField('Date', [validators.required()], default=dt.datetime.now) modified = fields.HiddenField('Modified') slug = fields.StringField('Slug') # TODO: validate slug collision language = fields.SmartSelect2Field( 'Language', choices=lambda: [(lng, lng) for lng in current_app.config.get( 'BABEL_LANGUAGES', ['en'])], default=get_default_language) # translations = fields.HiddenField('Translations') # todo: ^ create action 'add translation' published = fields.BooleanField('Status', render_kw={ 'data-toggle': "toggle", 'data-on': "Published", 'data-off': "Draft", "data-onstyle": 'success' })
class BaseEditForm(BaseForm): """Edit form with all missing fields except `content`""" content_type = fields.PassiveStringField(_('Type'), render_kw=READ_ONLY) content_format = fields.PassiveStringField(_('Format'), render_kw=READ_ONLY) tags = fields.Select2TagsField(_('Tags'), save_as_list=True) # todo: ^ provide settings.default_tags + db_query date = fields.DateTimeField(_('Date'), [validators.required()], default=dt.datetime.now) # todo: ^default should be now modified = fields.HiddenField(_('Modified')) # todo: ^populate on save slug = fields.StringField(_('Slug')) # todo: create based on category / title language = fields.SmartSelect2Field( _('Language'), choices=lambda: [(lng, lng) for lng in current_app.config.get( 'BABEL_LANGUAGES', ['en'])]) translations = fields.HiddenField(_('Translations')) # todo: ^ create action 'add translation' published = fields.BooleanField(_('Status'), render_kw={ 'data-toggle': "toggle", 'data-on': _("Published"), 'data-off': _("Draft"), "data-onstyle": 'success' })
class TweetForm(Form): name = fields.StringField('Name') user_id = fields.SelectField('User', widget=Select2Widget()) text = fields.StringField('Text') testie = fields.BooleanField('Test')