跳转到主要内容

添加Bootstrap 4组件作为插件。

项目描述

pypi build coverage

django CMS Bootstrap 4 是一个插件包,为django CMS提供来自流行的Bootstrap 4库的几个组件。

preview.gif

为该项目贡献力量,赢得奖励

由于这是一个开源项目,我们欢迎每个人参与 项目为其贡献获得奖励。成为我们出色社区的一员,帮助我们打造世界上最优秀的 CMS。

我们非常乐意接收您以问题报告和拉取请求形式提供的反馈。在提交您的拉取请求之前,请查阅我们的 贡献指南

项目使用 git 预提交钩子来维护代码质量。请按照安装步骤在您的开发环境中设置 pre-commit

我们感谢所有帮助创建和维护此包的贡献者。贡献者名单位于 贡献者 部分。

文档

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

python django djangocms

  • Django Filer 1.7 或更高版本

  • Django Text CKEditor 3.1 或更高版本

确保已正确安装和配置 django Filerdjango CMS Text CKEditor

安装

手动安装

  • 运行 pip install djangocms-bootstrap4

  • 将以下条目添加到您的 INSTALLED_APPS

    'djangocms_icon',
    'djangocms_link',
    'djangocms_picture',
    'djangocms_bootstrap4',
    'djangocms_bootstrap4.contrib.bootstrap4_alerts',
    'djangocms_bootstrap4.contrib.bootstrap4_badge',
    'djangocms_bootstrap4.contrib.bootstrap4_card',
    'djangocms_bootstrap4.contrib.bootstrap4_carousel',
    'djangocms_bootstrap4.contrib.bootstrap4_collapse',
    'djangocms_bootstrap4.contrib.bootstrap4_content',
    'djangocms_bootstrap4.contrib.bootstrap4_grid',
    'djangocms_bootstrap4.contrib.bootstrap4_jumbotron',
    'djangocms_bootstrap4.contrib.bootstrap4_link',
    'djangocms_bootstrap4.contrib.bootstrap4_listgroup',
    'djangocms_bootstrap4.contrib.bootstrap4_media',
    'djangocms_bootstrap4.contrib.bootstrap4_picture',
    'djangocms_bootstrap4.contrib.bootstrap4_tabs',
    'djangocms_bootstrap4.contrib.bootstrap4_utilities',
  • 运行 python manage.py migrate

代码插件使用 ace 代码编辑器,默认情况下从 CDN 加载。如果您希望 ace 代码编辑器从静态文件提供服务,请在您的需求或 pip 中使用 djangocms-bootstrap4[static-ace] 而不是 djangocms-bootstrap4。通过将 djangocms_static_ace 添加到项目 INSTALLED_APPS 中,使 ace 代码编辑器的静态文件可供项目使用。

配置

django CMS Bootstrap 4 使用 以下 django CMS 插件

它提供了以下 标准 Bootstrap 4 组件

django CMS Bootstrap 4 不会 将样式或 JavaScript 文件添加到您的前端,这些需要您自行添加。

设置

django CMS Bootstrap 4 有多种设置,目前可以更改的如下

DJANGOCMS_BOOTSTRAP4_TAG_CHOICES = ['div', 'section', 'article', 'header', 'footer', 'aside']

DJANGOCMS_BOOTSTRAP4_CAROUSEL_TEMPLATES = (
    ('default', _('Default')),
)

DJANGOCMS_BOOTSTRAP4_GRID_SIZE = 12
DJANGOCMS_BOOTSTRAP4_GRID_CONTAINERS = (
    (_('Default'), (
        ('container', _('Container')),
        ('container-fluid', _('Fluid container')),
    )),
    (_('Custom'), (
        ('container-yours', _('Your container')),
    )),
)
DJANGOCMS_BOOTSTRAP4_GRID_COLUMN_CHOICES = (
    ('col', _('Column')),
    ('w-100', _('Break')),
    ('', _('Empty'))
)

DJANGOCMS_BOOTSTRAP4_USE_ICONS = True

DJANGOCMS_BOOTSTRAP4_TAB_TEMPLATES = (
    ('default', _('Default')),
)

DJANGOCMS_BOOTSTRAP4_SPACER_SIZES = (
    ('0', '* 0'),
    ('1', '* .25'),
    ('2', '* .5'),
    ('3', '* 1'),
    ('4', '* 1.5'),
    ('5', '* 3'),
)

DJANGOCMS_BOOTSTRAP4_CAROUSEL_ASPECT_RATIOS = (
    (16, 9),
)

DJANGOCMS_BOOTSTRAP4_COLOR_STYLE_CHOICES = (
    ('primary', _('Primary')),
    ('secondary', _('Secondary')),
    ('success', _('Success')),
    ('danger', _('Danger')),
    ('warning', _('Warning')),
    ('info', _('Info')),
    ('light', _('Light')),
    ('dark', _('Dark')),
    ('custom', _('Custom')),
)

请注意,此包不支持 djangocms-text-ckeditor 的 拖放图片,因此请确保设置 TEXT_SAVE_IMAGE_FUNCTION = None

运行测试

您可以通过执行以下命令来运行测试

virtualenv env
source env/bin/activate
pip install -r tests/requirements/djNN_cmsNN.txt # where NN is an available appropriate version
python setup.py test

要运行前端,请确保使用 node 10.x

项目详情


下载文件

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

源代码发行版

djangocms_bootstrap4-3.0.2.tar.gz (117.9 kB 查看哈希值)

上传时间 源代码

构建发行版

djangocms_bootstrap4-3.0.2-py3-none-any.whl (181.9 kB 查看哈希值)

上传时间 Python 3

支持者