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 JList侦听器找不到符号   多点触摸跨平台java应用程序(Windows、Mac和Linux(Ubuntu)(可能是Android))   在UnitTest中找不到java类加载器资源   java当我尝试在Eclipse中运行我的minecraft mod时,我总是遇到这个错误,这是什么意思?   内部有一个同步块的静态方法,在java中阻止整个类?   不支持java操作:具有BillableStatus的费用在采购中应具有AccountBasedExpenseLineDetail行的CustomerRef   java运行时常量池GC集合   java无法解析配置“:app:\u debugApk”的所有依赖项。找不到名为“default”的配置   在GCP计算引擎中托管Neo4j的java   java如何从BroadcastReceiver更新片段选项卡?   线程“main”组织中的java异常。冬眠注释异常:@org。冬眠注释。表引用未知表:ProductForPractice   在Java/Groovy中嵌入处理   java Android REST教程/示例项目   java我可以在同一测试中在一个模拟器上启动应用程序,在另一个模拟器上启动移动浏览器吗?   java如何更改通知横幅的方向?   安卓 Java帮助实现Firebase授权   if else之后的rs.next()中出现java错误?