跳转到主要内容

为django CMS添加样式插件

项目描述

pypi build coverage

django CMS 风格 是一个用于 django CMS 的插件,允许您创建包含类、样式、id 和其他可由插件设置定义的属性的 HTML 容器。

preview.gif

为这个项目贡献力量并赢得奖励

由于这是一个开源项目,我们欢迎每个人都 参与项目为他们的贡献获得奖励。成为这个优秀社区的一部分,并帮助我们使 django CMS 成为世界上最好的 CMS。

我们将很高兴收到您以问题和拉取请求形式提供的反馈。在提交您的拉取请求之前,请查看我们的 贡献指南

我们感谢所有帮助创建和维护此包的贡献者。贡献者列在 贡献者 部分。

文档

有关其他依赖项,请参阅 setup.py 文件中的 REQUIREMENTS

python django djangocms

安装

手动安装

  • 运行 pip install djangocms-style

  • djangocms_style 添加到您的 INSTALLED_APPS

  • 运行 python manage.py migrate djangocms_style

配置

django CMS 风格使您能够提供一个预定义类列表,作为首选项显示,默认选项为

DJANGOCMS_STYLE_CHOICES = ['container', 'content', 'teaser']

鼓励您根据项目规范修改此设置。

此插件提供了所有实例的 default 模板。您可以通过添加 DJANGOCMS_STYLE_TEMPLATES 设置来提供额外的模板选项

DJANGOCMS_STYLE_TEMPLATES = [
    ('feature', _('Feature')),
]

您需要在 templates/djangocms_style/ 内创建 feature 文件夹,否则您将收到 模板不存在 错误。您可以通过将此目录中的 default 文件夹复制并重命名为 feature 来完成此操作。

还可以配置可用的标签,默认选项为

DJANGOCMS_STYLE_TAGS = ['div', 'article', 'section', 'header', 'footer',
                        'h1', 'h2', 'h3', 'h4', 'h5', 'h6']

注意

All tags included in this list should be "paired tags" that require a
closing tag. It does not make sense to attempt to use 'img', 'input',
'meta', or other self-closing tags 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
``DJANGOCMS_STYLE_TAGS`` (though, we do not prevent this). If you have
an application where you find yourself wishing to do this, please see
djangocms-snippet as an alternative, but note these projects also come
with appropriate security warnings.

之后您可以在此样式插件内部放置任意数量的其他插件。它将创建一个 div(或其他标签类型)并带有先前选择的类,围绕包含的插件。

运行测试

您可以通过执行以下操作来运行测试

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

下载文件

下载适合您平台的项目文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

djangocms-style-3.1.0.tar.gz (28.8 kB 查看哈希值)

上传时间

构建分发版

djangocms_style-3.1.0-py3-none-any.whl (127.8 kB 查看哈希值)

上传时间 Python 3

支持者