Django CMS的样式插件
aldryn-style的Python项目详细描述
Aldryn Style提供了一个插件,通过 在包含元素上放置类名。
安装
此插件需要django cms2.4或更高版本才能正确安装。
- 在您的virtualenv运行pip install aldryn-style
- 将'aldryn_style'添加到INSTALLED_APPS设置中。
- 运行manage.py migrate aldryn_style。
用法
您可以在设置中定义样式和标记类型。py:
# define this lambda if it isn't already defined in your settings... _ = lambda s: s ALDRYN_STYLE_CLASS_NAMES = ( ('info', _('info')), ('new', _('new')), ('hint', _('hint')), ) ALDRYN_STYLE_ALLOWED_TAGS = [ 'div', 'p', 'span', 'article', 'section', 'header', 'footer', ]
默认情况下,如果未提供ALDRYN_STYLE_ALLOWED_TAGS,或包含 空列表,则默认为以下列表 与以前版本的兼容性:
ALDRYN_STYLE_ALLOWED_TAGS = [ 'div', 'article', 'section', 'p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'footer', ]
注意:
All tags included in this list should be "paired tags" that require a closing tag. It does not make sense to attempt to use 'button', 'input', 'img', or other self-closing tag in this setting. Also, the developer is advised to choose the tag-types wisely to avoid HTML validation issues and/or unintentional security vulnerabilities. For example, the 'script' tag should never be allowed in ``ALDRYN_STYLE_ALLOWED_TAGS`` (though, we do not prevent this). If you have an application where you find yourself wishing to do this, please see djangocms-snippet or aldryn-snippet as an alternative, but note these projects also come with appropriate security warnings.
在那之后,你可以在这个样式插件中放置任何数量的其他插件。 它将创建一个div(或其他标记类型),其中包含先前选择的类 在包含的插件周围。