Skip to main content

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.

Compatibility

This package supports the following versions (aligned with CodeRed CMS compatibility matrix):

CodeRed CMS Wagtail Python Status
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 ? Tested & Supported

Minimum Requirements:

  • CodeRed CMS: 4.0+
  • Wagtail: 6.0+ (required for template tag compatibility)
  • Python: 3.8+

Note: Wagtail 4.x and earlier are not supported due to template tag API differences (classname parameter requirement). This package has been tested with Wagtail 6.0 and is compatible with all Wagtail 6.x versions (6.0-6.4).

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',
        ...
        '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/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crx_hslayers-6.4.0.tar.gz (11.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crx_hslayers-6.4.0-py3-none-any.whl (11.7 MB view details)

Uploaded Python 3

File details

Details for the file crx_hslayers-6.4.0.tar.gz.

File metadata

  • Download URL: crx_hslayers-6.4.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

Hashes for crx_hslayers-6.4.0.tar.gz
Algorithm Hash digest
SHA256 dff9e270640f7270270480e08dcfebece80a09a1d3653bd9f2a03a8d4d484187
MD5 53c31862e13def816651f846bca43229
BLAKE2b-256 49edff1693e0dfe55ef5b75862b90afe754dfe9d8fa522474480543936677341

See more details on using hashes here.

File details

Details for the file crx_hslayers-6.4.0-py3-none-any.whl.

File metadata

  • Download URL: crx_hslayers-6.4.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

Hashes for crx_hslayers-6.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66d5693a94b532d8efd330a699219963620eae337b2a87112e38d7e3abbf1afd
MD5 e82097606c5623462f00203c7c5204d4
BLAKE2b-256 5e942d29356a69b8959f8545be4fd4650aee415e2d34bb8a553eba802ae1e458

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page