Skip to main content
https://badge.fury.io/py/django-easy-maps.svg https://img.shields.io/pypi/pyversions/django-easy-maps.svg https://img.shields.io/pypi/djversions/django-easy-maps.svg https://github.com/bashu/django-easy-maps/actions/workflows/test.yml/badge.svg

This app makes it easy to display a map for any given address in django templates. No manual geocoding, html/js copy-pasting or Django model changes are needed.

Maintained by Basil Shubin, and some great contributors.

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install django-easy-maps

Setup

You’ll need to add easy_maps to INSTALLED_APPS in your project’s settings.py file:

INSTALLED_APPS += [
    'easy_maps',
]

Then run ./manage.py migrate to create the required database tables.

Configuration

The only mandatory configuration is the EASY_MAPS_GOOGLE_KEY variable:

EASY_MAPS_GOOGLE_KEY = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___0123456789'

If you need a place to center the map at when no address is inserted yet, add the latitude and longitude to the EASY_MAPS_CENTER variable in your settings.py like the following:

EASY_MAPS_CENTER = (-41.3, 32)

Other optional settings:

# Optional
EASY_MAPS_ZOOM = 8  # Default zoom level, see https://developers.google.com/maps/documentation/javascript/tutorial#MapOptions for more information.
EASY_MAPS_LANGUAGE = 'ru'  # See https://developers.google.com/maps/faq#languagesupport for supported languages.

Please see the example application. This application is used to manually test the functionalities of this package. This also serves as a good example.

You need Django 1.8 or above to run that. It might run on older versions but that is not tested.

Usage

First of all, load the easy_map_tags in every template where you want to use it:

{% load easy_maps_tags %}

Use:

{% easy_map <address> [<width> <height>] [<zoom>] [using <template_name>] %}

For example:

{% load easy_maps_tags %}

<!-- Default map with 300x400 dimensions -->
{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

<!-- Variable address, custom detail level and custom template -->
{% easy_map address 200 200 5 using "map.html" %}

The coordinates for map will be obtained using google geocoder on first access. Then they’ll be cached in DB. Django’s template caching can be used later in order to prevent DB access on each map render:

{% load easy_maps_tags cache %}

{% cache 600 my_map firm.address %}
    {% easy_map firm.address 300 400 %}
{% endcache %}

Templates

If the default map template is not sufficient then a custom map template can be used. For example:

{% easy_map address using "map.html" %}
{% easy_map address 200 300 5 using "map.html" %}

The template will have map (easy_maps.Address instance auto-created for passed address on first access), width, height and zoom variables. The outer template context is passed to the rendered template as well.

You can start your own template from scratch or just override some blocks in the default template.

Please refer to https://developers.google.com/maps/documentation/javascript/ for detailed Google Maps JavaScript API help.

Widgets

django-easy-maps provides a basic widget that displays a map under the address field. It can be used in the admin for map previews. For example:

from django import forms
from django.contrib import admin

from easy_maps.widgets import AddressWithMapWidget

from .models import Firm

class FirmAdmin(admin.ModelAdmin):
    class form(forms.ModelForm):
        class Meta:
            widgets = {
                'address': AddressWithMapWidget({'class': 'vTextField'})
            }

admin.site.register(Firm, FirmAdmin)

address field should be either a CharField or TextField.

Contributing

If you’ve found a bug, implemented a feature or customized the template and think it is useful then please consider contributing. Patches, pull requests or just suggestions are welcome!

Credits

django-easy-maps was originally started by Mikhail Korobov who has now unfortunately abandoned the project.

License

django-easy-maps is released under the MIT license.

Changes

1.1.4 (2026-08-16)

  • Dropped support for Python < 3.10 and Django < 5.2; added support for Python 3.10-3.14 and Django 5.2, 6.0 and 6.1.

  • Fixed Address using the legacy AutoField instead of BigAutoField for its primary key (#84).

1.1.3 (2021-10-09)

  • Removed deprecaded code, various bugfixes.

1.1.2 (2020-10-02)

  • Added support for Python 3.9

1.1.1 (2020-07-04)

  • Dropped support for Python 2.x

1.1.0 (2020-02-29)

  • Added support for Django 3.x.

1.0.2 (2019-05-28)

  • Check is EASY_MAPS_GOOGLE_MAPS_API_KEY is not None before raising warning.

1.0.1 (2019-04-21)

  • Fixed using callback for a non computed address

1.0.0 (2019-03-29)

  • Added new option EASY_MAPS_ZOOM (16 by default).

  • Added new option EASY_MAPS_LANGUAGE (‘en’ by default).

  • EASY_MAPS_GOOGLE_MAPS_API_KEY deprecated in favor of historical EASY_MAPS_GOOGLE_KEY option.

0.9.4 (2019-03-28)

  • Added support for Django 2.x, dropped support for Django < 1.11. It may still work with Django 1.8, but this is no longer tested.

  • Make sure GoogleV3 geocoder respect API key.

0.9.3 (2016-11-11)

  • Google Maps API key configuration.

  • Revert from setuptools back to distutils.

  • Russian translation is added.

0.9.2 (2015-07-12)

  • Replacing broken 0.9.1 release, back to setuptools.

0.9.1 (2015-07-02)

  • Resolve the 500 error when google send a no results info.

  • Resolving width / height and other variables in template.

0.9.0 (2014-02-11)

  • Backwards incompatible: added support for geopy >= 0.96, dropped support for geopy < 0.96.

  • Added support for Django 1.6, dropped support for Django 1.3. It may still work with Django 1.3, but this is no longer tested.

  • Experimental Python 3.3 support (no code changes - app seems to work as-is).

0.8.4 (2013-08-27)

  • fix bad 0.8.3 release

0.8.3 (2013-08-27)

  • easy_map tag now works when address is None.

0.8.2 (2013-07-02)

  • Unique constraint is added to Address.address field (to prevent MultipleObjectsReturned exceptions).

    In order to upgrade, run

    python manage.py migrate easy_maps

  • German translation is added.

0.8.1 (2013-03-25)

  • Fix regressions in geocoding errors handling introduced in 0.8.

0.8.0 (2013-03-24)

  • Testing improvements;

  • EASY_MAPS_CENTER setting for default map coordinates;

  • allow to pass an Address instance as argument of easy_map tag;

  • better error handling;

  • switch to GoogleV3 geocoder;

  • customization hook: it is now possible to use a custom geocoding method;

  • EASY_MAPS_GOOGLE_KEY now does nothing (it is not a meaningful option for V3 Geocoding API).

Minimum required Django version is 1.3 since this release. It may work with older versions, but this is untested.

0.7.4 (2013-01-03)

  • switch to https;

  • make example settings Django 1.4 compatible;

0.7.3 (2012-09-21)

  • use only first placemark from geocoder.

0.7.2 (2012-01-07)

  • static fallback for map.html;

  • fix localization of floats.

0.7.1 (2011-01-31)

  • better error handling;

  • EASY_MAPS_GOOGLE_KEY setting.

0.7.0 (2010-12-24)

  • longtitude -> longitude;

  • display is fixed for comma-delimited float locales.

0.6.0 (2010-12-02)

  • admin preview widget;

  • bugfixes.

0.5.0 (2010-12-01)

  • Initial release

Download files

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

Source Distribution

django_easy_maps-1.1.4.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

django_easy_maps-1.1.4-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file django_easy_maps-1.1.4.tar.gz.

File metadata

  • Download URL: django_easy_maps-1.1.4.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_easy_maps-1.1.4.tar.gz
Algorithm Hash digest
SHA256 cbc4fb2ce6740e1aba2cbc63ef83225a22b5ef06008bb7d9ac343e7c256dd8e0
MD5 6efe1429fbaafff418c7d3ffc17bfb7c
BLAKE2b-256 d8f54510b62f2094daacab22e8228ec14e19a4caaccce7be2c56a114309a7120

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_easy_maps-1.1.4.tar.gz:

Publisher: release.yml on bashu/django-easy-maps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_easy_maps-1.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_easy_maps-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f2e9cf1c71497999ada01fa44c262df8f54792a6747a84697c8b565284f7b22a
MD5 a4786441d12d2c8f7f5a3e3395738ae1
BLAKE2b-256 da529b66100369d68d35f9323c1f2d06d458b04566dadee1a1d5d2d508ce91d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_easy_maps-1.1.4-py3-none-any.whl:

Publisher: release.yml on bashu/django-easy-maps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.1.5

2 files

This release

1.1.4 This release

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

1 file

0.9

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8

1 file

0.7.4

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7

1 file

0.6

1 file

0.5.4

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5

1 file

Supported by

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