Skip to main content

wagtail-maps

Create and display maps with points in Wagtail.

Warning! This project is still early on in its development lifecycle. It is possible for breaking changes to occur between versions until reaching a stable 1.0. Feedback and pull requests are welcome.

This package extend Wagtail to add a new Map model, which is composed by one or more points. Each point may have a title, some content and link to an internal or external URL. Once you have configured your map from the Wagtail admin, you will be able to display it in a page - e.g. as a StreamField block.

Requirements

This package requires the following:

  • Wagtail (7.4 LTS)
  • Django (5.2 LTS)
  • Python 3 (3.10, 3.11, 3.12, 3.13, 3.14)

Installation

  1. Install using pip:
    pip install wagtail-maps
    
  2. Add wagtail_maps to your INSTALLED_APPS setting:
    INSTALLED_APPS = [
        # ...
        'wagtail_maps',
        # ...
    ]
    
  3. Include the URL of wagtail-maps to your urls.py file:
    from wagtail_maps import urls as wagtailmaps_urls
    
    urlpatterns = [
        # ...
        path('maps/', include(wagtailmaps_urls)),
        # ...
    ]
    
  4. Run python manage.py migrate to create the models

Usage

A StreamField block wagtail_maps.blocks.MapBlock can be used to display a given Map object with its points in your page. To render this block in your frontend, you will have to include the following assets in the templates which can contain it - or in your base template:

  • the JavaScript code that renders the map with Leaflet thanks to a Stimulus controller:
    <script src="{% static "wagtail_maps/js/map-block.js" %}"></script>
    
  • the default Leaflet stylesheet if you don't provide your own:
    <link rel="stylesheet" href="{% static "wagtail_maps/vendor/leaflet.css" %}">
    

Development

Quick start

To set up a development environment, ensure that Python 3 is installed on your system. Then:

  1. Clone this repository
  2. Create a virtual environment and activate it:
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install this package and its requirements:
    (venv)$ pip install --editable ".[factories]" --group dev
    

To run the test app interactively, use tox -e interactive, visit http://127.0.0.1:8020/admin and log in with admin / changeme.

Contributing

The tests are written with pytest and code coverage is measured with coverage. You can use the following commands while developing:

  • make test: run the tests and output a quick report of code coverage
  • make test-wip: only run the tests marked as 'wip'
  • make test-all: run the tests on all supported versions of Django and Wagtail with tox

The Python code is formatted and linted thanks to ruff. You can check the code with make lint and try to fix the reported issues with make format.

When submitting a pull-request, please ensure that the code is well formatted and covered, and that all the tests pass.

License

This extension is mainly developed by Cliss XXI and licensed under the AGPLv3+. Any contribution is welcome!

Metadata

Release files for wagtail-maps 0.4.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 wagtail-maps 0.4.0
File Size Uploaded
wagtail_maps-0.4.0.tar.gz 373.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-maps 0.4.0
File Interpreter ABI Platform
wagtail_maps-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 758.0 kB

Release files / wagtail_maps-0.4.0.tar.gz

Download URL wagtail_maps-0.4.0.tar.gz
Size 373.3 kB
Tags Source
SHA-256 checksum
How to use checksums
884ff0b1b1e5fc770806309f179405b3b4be6d647a52eb3da1ec6149327cae55
BLAKE2b-256 checksum
How to use checksums
34f6495f979b19ccda3105cde1a86b3842fb63efcda0c3c8be2a3222f463d272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / wagtail_maps-0.4.0-py3-none-any.whl

Download URL wagtail_maps-0.4.0-py3-none-any.whl
Size 384.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97a342e3f81861024302c1dc88e69a4ff0f9c38dbac2df91a1db9982d6b8ed8a
BLAKE2b-256 checksum
How to use checksums
d691bb7f0df86ba76d64f1f9373b9c7be60646fea21b20c861129f1a89767ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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