HSLayers-NG integrated into Wagtail CMS with Codered
Project description
HSLayers-NG map widget for Wagtail CodeRed CMS
Note: Has npm dependency on HSLayers-NG that gets automatically installed into static files. python manage.py collectstatic must be executed for the module to correctly locate the HSLayers bundles.
Instalation
-
Install this package from PyPi using folowing command:
$ pip install crx-hslayers wagtail-crx-block-frontend-assets -
Add 'hslayers' and 'wagtail_crx_block_frontend_assets' to the INSTALLED_APPS list in the settings/base.py
INSTALLED_APPS = [ # This project 'website', # CodeRed CMS 'coderedcms', 'bootstrap4', ... 'wagtail_crx_block_frontend_assets', 'crx_hslayers' ]
-
Add MapBlock to your model, for example:
from wagtail.fields import StreamField from coderedcms.models import CoderedWebPage from crx_hslayers.blocks import MapBlock class WebPage(CoderedWebPage): ... body = StreamField( block_types=[ ("map_block", MapBlock()) ], null=True, blank=True, use_json_field=True, ) ...
-
Define place in your templates where you want your MapBlock assets to be rendered like this:
{% extends "coderedcms/pages/base.html" %} {% block custom_assets %} {{ block.super }} {% include "wagtail_crx_block_frontend_assets/includes/block_assets.html" with required_file_extension=".css" %} {% endblock custom_assets %} {% block custom_scripts %} {{ block.super }} {% include "wagtail_crx_block_frontend_assets/includes/block_assets.html" with required_file_extension=".js" %} {% endblock custom_scripts %}
-
Create new migration with changes made to your model
python manage.py makemigrations -
Now apply your new migration.
python manage.py migrate -
Install HSLayers app package from npm
cd {YOUR PYTHON VENV PATH}/lib/python3.12/site-packages/crx_hslayers/static/ npm install -
Collect static files from crx-hslayers to your Wagtail site
$ python manage.py collectstatic
Development
Update semantic version of the package
Run test update without commiting
$ bumpver update --patch(--minor|--major) --dry
Run update and commit the changes to the repo
$ bumpver update --patch(--minor|--major)
Manual package publishing
Delete all previous builds in the dist/* directory.
Linux:
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
Windows:
py -m build
py -m pip install --upgrade twine
py -m twine upload dist/*
Use __token__ for the username and API token acquired at pypi.org for password.
Upload to Test PyPi:
python3 -m twine upload --repository testpypi dist/*
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crx_hslayers-6.2.0.tar.gz.
File metadata
- Download URL: crx_hslayers-6.2.0.tar.gz
- Upload date:
- Size: 11.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7530ade9fd6d1d4475d06b2ae97c09ae81056343ebdf81aad4aaecd500934e4
|
|
| MD5 |
66a25cf6456a084dec1e0b572e2016f1
|
|
| BLAKE2b-256 |
75a5acd48cb66e8f32f8c8f75f80febd99c253a70c131b599aed408baaf5e57c
|
File details
Details for the file crx_hslayers-6.2.0-py3-none-any.whl.
File metadata
- Download URL: crx_hslayers-6.2.0-py3-none-any.whl
- Upload date:
- Size: 11.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a3df64f0285c9c7df434320069fb1372500a3fa449251fe669c2905e2e51f75
|
|
| MD5 |
f755ca67c7e2b15b77f4d543927713cf
|
|
| BLAKE2b-256 |
3a49f90f6dbb3fd2bce62f59d43030344fc0c04f27b93c00153f024891e4f50f
|