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对ServiceListener和ServiceTracker调用提供了哪些排序保证?   java找不到方法格式的符号(DateTimeFormatter)?   mysql有没有一种方法可以将TCPDump输出到一个文件中,并用Java对其进行过滤,每5秒钟用新数据覆盖一次该文件?   java如何最好地配置用户上传支持文件的上传位置   java我在Android上使用OData4j,我无法获取实体   JPA实体关系简单示例中的java获取错误   JAVANoClassDefFoundError:安卓。应用程序。用法安卓中的UsageStatsManager   Eclipse中javaoo代码分析   java MethodVisitor抛出类格式错误   java为什么在从ViewModel调用时,改型排队不起作用?   调试小程序Java控制台:删除跟踪消息大小限制   java复杂安卓活动动画   java如何在使用JDOM2解析XML时忽略注释内容   java通过循环创建文本字段   即使在bufferedwriter关闭后也未发现java文件异常   单链表恢复中的java错误