向django cms添加样式插件
djangocms-style的Python项目详细描述
django cms style是django CMS的插件 允许您创建包含类、样式、id的html容器 以及其他可以通过插件设置定义的属性。
此加载项与Divio Cloud兼容,也可以在 django CMS Marketplace 便于安装。
贡献
这是一个开源项目。我们很高兴收到您的 以问题和请求的形式提供反馈。在提交您的 拉动请求,请查看我们的contribution guidelines。
此加载项与Divio Cloud兼容,也可以在 django CMS Marketplace 便于安装。
你能做的最简单的贡献之一就是帮助翻译这个插件 Transifex。
文档
请参阅setup.py中的REQUIREMENTS。 其他依赖项的文件:
安装
对于手动安装:
- 运行pip install djangocms-style
- 将djangocms_style添加到INSTALLED_APPS
- 运行python manage.py migrate djangocms_style
配置
Django CMS样式允许您提供一个预定义类的列表 显示为第一个选项,默认选项为:
DJANGOCMS_STYLE_CHOICES = ['container', 'content', 'teaser']
我们鼓励您将该设置修改为项目规范。
此加载项为所有实例提供default模板。你可以提供 通过添加^{tt7}来选择其他模板$ 设置:
DJANGOCMS_STYLE_TEMPLATES = [ ('feature', _('Feature')), ]
您需要在^{tt8}中创建功能文件夹$ 否则,将获得一个^ {EM1} $模板不存在“EEM>错误”。你可以通过 复制目录中的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