Installation¶
Note
The library has been tested against Python 2.7 and 3.4-3.6. It is compatible with Django 1.6-2.1.
Installing from PyPi¶
Note
This is the preferred installation method.
$ pip install django-map-widgets
Installing from source¶
Alternatively, install the package from github
$ pip install git+git://github.com/erdem/django-map-widgets.git
Add ‘map_widgets’ to your INSTALLED_APPS in settings.py
INSTALLED_APPS = [
...
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mapwidgets',
]
Collects the static files into STATIC_ROOT
.
python manage.py collectstatic
If you are using mapwidgets
in your regular django views, you need to add {{ form.media }}
template variable to the <head>
or end of the <body>
HTML section of your templates:
<!DOCTYPE html>
<html>
<head>
...
{{ form.media }}
</head>
<body>
...
</body>
</html>
Note
If you are using mapwidgets
on the Django Admin, you don’t need to add {{ form.media }}
any template files. The media variable already added in default Django Admin templates.
Requirements¶
Django Map Widgets needs Jquery 2.x dependency to work in your regular views. In Django Admin case, you don’t need to provide the jQuery just because it’s already available on django.jQuery
namespace.