Skip to main content

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.

Compatibility

This package supports the following versions. CRX 3–5 follow the CodeRed CMS compatibility matrix. CRX 6 is tested here with Wagtail 7.1 and 7.4 (CodeRed documents CRX 6.0 as Wagtail 7.0–7.1).

CodeRed CMS Wagtail Python Status
6.0 7.1, 7.4 3.10-3.13 ✅ Supported
5.0 6.3-6.4 3.9-3.13 ✅ Supported
4.1 6.3 3.9-3.13 ✅ Supported
4.0 6.0-6.2 3.8-3.12 ✅ Supported
3.0 5.2 LTS 3.8-3.12 ✅ Supported

Minimum Requirements:

  • CodeRed CMS: 3.0+
  • Wagtail: 5.0+
  • Python: 3.8+

Note: Wagtail 4.x and earlier are not supported due to template tag API differences (classname parameter requirement).

Instalation

  1. Install this package from PyPi using folowing command:

    $ pip install crx-hslayers wagtail-crx-block-frontend-assets
    
  2. 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',  # CRX 3.x; CRX 4+ / 6 use 'django_bootstrap5'
        ...
        'wagtail_crx_block_frontend_assets',
        'crx_hslayers'
    ]
    
  3. 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,
        )
    
        ...
    
  4. 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 %}
    
  5. Create new migration with changes made to your model

    python manage.py makemigrations
    
  6. Now apply your new migration.

    python manage.py migrate
    
  7. Install HSLayers app package from npm

    cd {YOUR PYTHON VENV PATH}/lib/python3.12/site-packages/crx_hslayers/static/ 
    npm install
    
  8. 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/*

Metadata

Release files for crx-hslayers 6.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crx-hslayers 6.6.0
File Size Uploaded
crx_hslayers-6.6.0.tar.gz 11.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for crx-hslayers 6.6.0
File Interpreter ABI Platform
crx_hslayers-6.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 MB

Release files / crx_hslayers-6.6.0.tar.gz

Download URL crx_hslayers-6.6.0.tar.gz
Size 11.5 MB
Tags Source
SHA-256 checksum
How to use checksums
44b04b0cc20d05571e7662396ce352cff02874b5de3f16dec77b1a44a2903830
BLAKE2b-256 checksum
How to use checksums
95644e369b9576cc04ad9a8c0ce98905fa8130b25ae6d9d8f08538d1b26f7ab7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / crx_hslayers-6.6.0-py3-none-any.whl

Download URL crx_hslayers-6.6.0-py3-none-any.whl
Size 11.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
11177487b5e0b86f2366f193cc761d47e7343452db21404e0f91485d85594231
BLAKE2b-256 checksum
How to use checksums
2f3bf8fed723368e89d41ae1bd5ca0d1138a4fd7347c6d3c07e76050e2a8e2c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page