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(或其他标记类型),其中包含先前选择的类 在包含的插件周围。

翻译

如果您想帮助翻译插件,请在transifex上进行:

https://www.transifex.com/projects/p/django-cms/resource/aldryn-style/

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java是否存在这样一种场景:Java7的Hashmap实现优于Java8的实现   java如何打印这些完整的数组?   java BuildException:未能执行aapt   java如何使用类。未知类型的集合返回的cast()   java准备语句返回错误的值   webview 安卓中的java显示身份验证对话框   java如何重命名列名JPA Hibernate   java查询从特定用户和特定时间段的Oracle表(通过比较原始表和备份表)中选择修改的行   java Youtube视频仅在三星S6设备上加载时自动暂停   未调用java RecyclerView getItemViewType   使用JSch setCommand执行带有源选项的java Shell ping命令时失败   java Hibernate:无法删除|删除分离的实例   Java Spring@MappedSuperclass字段作为子类中的@Id字段   java Android:确定单击了哪个按钮,因为该按钮未在xml中定义   如何计算java阵列内存使用率   使用Java查找按字母顺序排列的第一个字符串   javascript注销功能刷新页面,但页面仍已登录   当接口作为参数提供时,java依赖项注入不起作用   java中带原语的字符串扭曲