Skip to content

v6.0.0

Compare
Choose a tag to compare
@marteinn marteinn released this 06 Feb 14:50
· 96 commits to main since this release

This is a big release that adds Leaflet support, moves GoogleMaps as its own panel/block types and deprecates GeoPanel/GeoBlock.

It also adds Telepath support to the widgets and therefore dropping < Wagtail 2.14 support.

Finally it also introduces the concept of geocoders, which lets us configure which geocoder to use in the address field. Currently Google Maps Geocoding and Nominatim are supported, but more might come in the future. (PR:s are much appreciated!)

Changelog:

  • Add support for Leaflet with LeafletPanel/LeafletBlock (Martin Sandström)
  • Add standalone block and panel for GoogleMaps (Martin Sandström)
  • Deprecate GeoPanel, GeoBlock and GeoWidget in favour of GoogleMapsPanel, GoogleMapsBlock and GoogleMapsWidget (Martin Sandström)
  • Add panel for address field (Martin Sandström)
  • Add geocoding support for Nominatim (Martin Sandström)
  • Add telepath to widgets (Martin Sandström)
  • Drop support for Wagtail < 2.14 (Martin Sandström)
  • Add Swedish translations (Martin Sandströms)
  • Fix: Disable form submit on latlang field enter (Martin Sandström)
  • Fix: Apply prettier formatting to all js (Martin Sandström)

Note: Upgrading from 5 to 6

6.0.0 is backwards compatible so GeoPanel/GeoField will continue to function but are now aliases to GoogleMapsPanel/GoogleMapsBlock. Using GeoPanel/GeoField will raise warnings. They will be removed in version 7.

Also note that it is still possible to supply a address parameter pointing to a FieldPanel, but this behaviour is also deprecated in favor of using GeoAddressPanel for your address field. This behaviour will also be removed in a feature release, most likely in 8.

To migrate to 6, do the following:

  • Replace GeoPanel with GoogleMapsPanel. Example:
from django.db import models
from wagtail.core.models import Page
from wagtailgeowidget.edit_handlers import GoogleMapsPanel

class StandardPage(Page):
    location = models.CharField(max_length=250, blank=True, null=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                GoogleMapsPanel("location"),
            ],
            _("Geo details"),
        ),
    ]
  • Replace GeoBlock with GoogleMapsBlock. Example:
from django.db import models
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtailgeowidget.blocks import GoogleMapsBlock
from wagtail.admin.edit_handlers import StreamFieldPanel

class StreamPage(Page):
    body = StreamField(
        [
            ("map", GoogleMapsBlock()),
        ]

    content_panels = Page.content_panels + [
        StreamFieldPanel("body"),
    ]
  • Replace FieldPanel('address') with GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS). Example:
from django.db import models
from wagtail.core.models import Page
from wagtailgeowidget.edit_handlers import (
    GeoAddressPanel,
    GoogleMapsPanel,
)
 from wagtailgeowidget import geocoders

class StandardPage(Page):
    address = models.CharField(max_length=250, blank=True, null=True)
    location = models.CharField(max_length=250, blank=True, null=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS),
                GoogleMapsPanel("location", address_field="address"),
            ],
            _("Geo details"),
        ),
    ]

New settings

Because of the new Leaflet panel/block we have two new settings:

  • GEO_WIDGET_LEAFLET_TILE_LAYER: Which title provider to use in Leaflet. By default it is OSM. (https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png).
  • GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS: The tile layer options for leaflet, it supports the following arguments. Default is {"attribution": '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}