Package: django-cms-bootstrap-grid-builder
This tool offers the preliminary drafting of a grid layout consisting of containers, rows and columns,
allows you to correctly define the spaces assigned to each page content,
and to map these spaces for the different responsive steps.DocumentationThe full documentation is athttps://django-cms-bootstrap-grid-builder.readthedocs.io/en/latest/.Quickstartwarning:ATTENTION !!! This package requiresdjango-cmsalready installed.Install Django CMS bootstrap grid builder:pip install django-cms-bootstrap-grid-builderAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'bootstrap_grid_builder',...)The first thing to do is to override the page creation
wizard with the one offered by the package.# project/urls.pyfromcms.cms_wizardsimportcms_page_wizard,cms_subpage_wizardfrombootstrap_grid_builder.cms_wizardsimportcms_wizardsfromcms.wizards.wizard_poolimportwizard_pool# OVERRIDE CMS WIZARDwizard_pool.unregister(cms_page_wizard)wizard_pool.unregister(cms_subpage_wizard)wizard_pool.register(cms_wizards.cms_page_wizard)wizard_pool.register(cms_wizards.cms_subpage_wizard)A variable must be defined to specify the name of the placeholder
that will contain the plugins generated by the page creation wizard.GRID_PLUGIN_STRUCTURE_PLACEHOLDER="grid_placeholder"Add the placeholder name inside your home.html template like this:{% load cms_tags sekizai_tags %}<html><head><title>{% page_attribute "page_title" %}</title>{% render_block "css" %}</head><body>{% cms_toolbar %}
        {% placeholder "grid_placeholder" %}
        {% render_block "js" %}</body></html>Then run migrate to apply package migrations:$ python manage.py migrateHowTo customize Grid Plugins & Grid Plugin ModelsYou can customize the wizard-generated plugins to add functionality or fields to the basic implementation of the tool.The plugins registered by the package are:GridContainerPluginGridRowPluginGridColPluginTo modify one of these plugins you need:Create an associated model in which to add your own field.Create a plugin in which to insert the field previously added to the model and make the unregister of
the base plugin and the register of the plugin just created.# your_app/models.pyclassMyCustomGridContainerPluginModel(GridContainerPluginAbstractModel):my_field=models.CharField("My Field",max_length=255)classMeta:verbose_name=_("My Custom grid container plugin")verbose_name_plural=_("My Custom grid container plugins")# your_app/cms_plugins.pyplugin_pool.unregister_plugin(GridContainerPlugin)@plugin_pool.register_pluginclassMyCustomGridContainerPlugin(GridContainerPlugin):model=MyCustomGridContainerPluginModelmodule=_("Custom")name=_("Custom Grid Container")render_template='path/to/my/custom/template.html'fieldsets=((None,{"fields":(("variant_class","tag_type",),("my_field",),)}),)Following these changes it is necessary to set variables in the settings.py file
to specify the name of the plugin that must be generated by the wizard instead of the base plugin.# project/settings.pyGRID_CONTAINER_PLUGIN="MyCustomGridContainerPlugin"# this are the others plugins variablesGRID_COL_PLUGIN=""GRID_ROW_PLUGIN=""After models creation run makemigration & migrate to create yours models in database.$ python manage.py makemigrations
$ python manage.py migrateRunning Testssource <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commands# Back-end
$ pip install -r requirements_dev.txt
$ pre-commit install
$ python manage.py migrate
$ python manage.py runserverFrontendThis is a Vue.js application for creating custom bootstrap grids throughout an intuitive interface and draggable elementsBrowser CompatibilityThe page-layout-builder component is compatible with modern browsers such as Chrome, Firefox, Safari, Opera, and Edge. It also supports Internet Explorer 11 but with limited performance.Frontend source folder ascii tree/django-cms-bootstrap-grid-builder/src
├─ main.js  //Entrypoint for build
├─ index.js  //Entrypoint for development
├─ components
│  ├─ CustomDragElement.vue
│  ├─ page-layout-builder.vue
│  ├─ GridItem.vue
│  ├─ GridLayout.vue
│  └─ index.js
└─ helpers
   ├─ DOM.js
   ├─ draggableUtils.js
   ├─ responsiveUtils.js
   └─ utils.jsHow it worksThe informations obtained from the interface configuration are serialized into a JSON object and sent to the backend wich replicates the desired grid structure with Django plugins templatesDevelopment commands# Front-end
$ npm i -g yarn rimraf @vue/cliz
$ yarn install
$ yarn serve (for development, lauches local live reloading server)
$ yarn build (for production build, creates dist at django-cms-bootstrap-grid-builder/bootstrap_grid_builder/static/cms_plugin_structure/dist)CreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageelement-resize-detectorinteractjsvue-drag-dropgoogle-palettebootstrapHistory0.1.0 (2021-11-04)First release on PyPI.0.1.1 (2021-11-05)Renamed LICENSE file in LICENSE.md for publication on PyPI.0.1.2 (2021-11-08)Added dist files removing dist from .gitignore and updated README.rst.