Skip to main content

Google Maps widget for address fields in Wagtail

Project description


![Wagtailgmaps screenshot](

Simple Google Maps address formatter for Wagtail fields.

# Quickstart

Assuming you have a [Wagtail]( project up and running:

``` $ pip install wagtailgmaps```

add wagtailgmaps to your `` in the INSTALLED_APPS section:


Add a couple of necessary constants in your `` file:

WAGTAIL_ADDRESS_MAP_CENTER = 'Wellington, New Zealand'
`WAGTAIL_ADDRESS_MAP_CENTER` must be a properly formatted address. Also, remember valid zoom levels go from 0 to 18. See [Map options]( for details.

As for now, only fields using `FieldPanel` inside a `MultiFieldPanel` are supported. This is due to the lack of support of the `classname` attribute for other panel fields other than `MultiFieldPanel`.

In your ``, your custom Page model would have something similar to:

address_panels = MultiFieldPanel([
FieldPanel('address', classname="gmap"),
], heading="Street Address")

Notice the `FieldPanel` is embedded in a `MultiFieldPanel`, even if it only contains a single element. If you define your `FieldPanel` outside it won't work. The app supports more than one map (field) at the same time.

When editing the model from the admin interface the affected field shows up with a map, like the screenshot above.

The field gets updated according to the [Google Geocoding Service]( each time:

* The map market gets dragged and dropped into a location (`dragend` JS event).
* Click happens somewhere in the map (`click` JS event).
* Return key is pressed after editing the field (`enterKey` JS event for return key only).

Feel free to edit the provided JS to add/edit the events you might need.

Once your address field is properly formatted and stored in the database you can use it in your front end Django templates. Example:

<a href="{{ address }}">Open map</a>

Project details

Download files

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

Files for wagtailgmaps, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size wagtailgmaps-0.2.2-py2.py3-none-any.whl (10.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size wagtailgmaps-0.2.2.tar.gz (6.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page