Registry / web-framework / django-map-widgets

django-map-widgets

JSON →
library0.5.2pypypiunverified

A Django library providing configurable and user-friendly map widgets for GeoDjango geometry fields. Supports Google Maps, Leaflet, and MapBox interactive maps with point, geometry, and inline formset widgets. Current version 0.5.2, released March 2025. Active development with regular releases.

pip install django-map-widgets
INSTALL
IMPORT
SIG · DJANGO-MAP-WIDGETS
D
django-map-widgets
web-frameworkpythonv0.5.2
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GooglePointFieldWidget
from mapwidgets.widgets import GooglePointFieldWidget
from map_widgets.widgets import GooglePointFieldWidget

Basic setup for Google Maps point widget; replace API key via environment variable.

# settings.py INSTALLED_APPS = [ 'django.contrib.gis', 'map_widgets', ] MAP_WIDGETS = { "GooglePointFieldWidget": ( ("zoom", 15), ("mapCenterLocation", [40.7128, -74.0060]), ("GooglePlaceAutocompleteOptions", {}), ), "GoogleMaps": { "apiKey": os.environ.get('GOOGLE_MAPS_API_KEY', ''), } } # models.py from django.contrib.gis.db import models class Location(models.Model): point = models.PointField() address = models.CharField(max_length=255) # admin.py from django.contrib.gis import admin from .models import Location from map_widgets.widgets import GooglePointFieldWidget class LocationAdmin(admin.GISModelAdmin): list_display = ('address',) formfield_overrides = { models.PointField: {"widget": GooglePointFieldWidget} } admin.site.register(Location, LocationAdmin)
Debug
Known issues
breakingv0.5.0 introduced a new settings structure. Old settings like GOOGLE_MAP_API_KEY no longer work; use MAP_WIDGETS dict instead.
fix
Replace MAP_WIDGETS = {'GooglePointFieldWidget': (('zoom', 15),)} and API key under 'GoogleMaps' key.
affects: <0.5.0
breakingv0.5.2 removed `id` and `name` from template context in BaseGeometryWidget.get_context() for Django 6.0 compatibility. If you override get_context(), you must call super() and handle context.
fix
Ensure custom widget get_context() calls super().get_context(attname, ...) and re-add id/name if needed.
affects: >=0.5.2
deprecatedGooglePlaceAutocompleteOptions settings have changed. Old 'autocomplete' key may be ignored.
fix
Use new structure inside MAP_WIDGETS['GooglePointFieldWidget'] tuple.
affects: >=0.5.0
gotchaMissing django.contrib.gis in INSTALLED_APPS or GDAL not installed causes silent failures.
fix
Ensure 'django.contrib.gis' is in INSTALLED_APPS and GDAL library is installed.
affects: all
gotchaWhen using ManifestStaticFilesStorage, run collectstatic after installation. v0.5.1 fixed a bug that caused errors during collectstatic.
fix
Upgrade to 0.5.1+ or manually copy static files.
affects: <0.5.1
Upgrade
Version history
0.5.2latest on PyPI · released Mar 7, 2026
Audit
Dependencies
DjangorequiredGeoDjango dependency; requires django.contrib.gis
django-leafletoptionalFor Leaflet interactive widgets (optional if using Google Maps or MapBox)
Agent activity
26 hits · last 30 days
node
20
OpenAI (training)
1
Resources
django-map-widgets — pip install django-map-widgets · libregistry