HSLayers-NG integrated into Wagtail CMS with Codered
Project description
HSLayers-NG map widget for Wagtail CodeRed CMS
Instalation
-
Copy whole codered-hslayers to the Wagtail root to a new folder named 'hslayers'
-
Add 'hslayers' to the INSTALLED_APPS list in the settings/base.py
INSTALLED_APPS = [
# This project
'website',
# CodeRed CMS
'coderedcms',
'bootstrap4',
...
'hslayers'
]
-
You have three options now:
-
Keep existing CodeRed 'Web Page', 'Article Landing Page' and 'Article Page' untouched and add a new page type 'Web Page Extended', 'Article Landing Page Extended' and 'Article Page Extended' with new widgets of hslayers
- Run hslayers migrations
$ python3 manage.py makemigrations hslayers
- Go to point 4
-
Modify existing CodeRed 'Web Page' and/or 'Article Landing Page' and/or 'Article Page' type and add hslayers widgets to it
-
Edit Wagtail's models.py file
- Add those imports at the top
from coderedcms.blocks import ( CONTENT_STREAMBLOCKS, LAYOUT_STREAMBLOCKS, GridBlock, HeroBlock, CardGridBlock, CardBlock ) from django.utils.translation import gettext_lazy as _ from hslayers import blocks from wagtail.core.fields import StreamField from wagtail.core.blocks import RawHTMLBlock
- Replace code of WebPage and/or ArticleIndexPage and/or ArticlePage function with the WebPage2 and/or ArticleIndexPageExtended and/or ArticlePageExtended function code from the hslayers/models.py file
-
Delete WebPage2 and/or ArticleIndexPageExtended and/or ArticlePageExtended method in the hslayers/models.py file
-
In case of ArticleIndexPage and ArticlePage overriding, don't forget to modify
subpage_types
andparent_page_types
to your needs. In this particular case delete 'hslayers.ArticlePageExtended' and 'hslayers.ArticleIndexPageExtended' from the code
parent_page_types = ['website.ArticleIndexPage', 'hslayers.ArticleIndexPageExtended'] ... subpage_types = ['website.ArticlePage', 'hslayers.ArticlePageExtended']
- Go to point 4
-
-
Use hslayers widgets in any other Wagtail models
- Take the code of WebPage2 and/or ArticleIndexPageExtended the hslayers/models.py file and modify it as you wish or use the widgets anywhere else
- Go to point 4
-
-
Update Wagtail migrations
$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py collectstatic
-
Restart Wagtail
-
New HSLayers blocks are added to the CMS
- HSLayers map
- Aligned Paragraph
- Header
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for crx_hslayers-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 115c8e1e32bccdd8bff8463b9fe93fed25eb62b3fdd808b69c6a83d2e3ac4c0f |
|
MD5 | da762695dd24a63ec97fa93beb129318 |
|
BLAKE2b-256 | d41329e93ac4120e239383745aa22105b53e8b3d25969c45652a36145e669b9b |