django-treasuremap app, makes it easy to store and display the location on the map using different providers (Google, Yandex).
Project description
django-treasuremap
django-treasuremap app, makes it easy to store and display the location on the map using different providers (Google, Yandex, etc).
Requirements
Python 2.7+ or Python 3.3+
Django 1.8+
Installation
Use your favorite Python package manager to install the app from PyPI, e.g.
Example:
pip install django-treasuremap
Add treasuremap to INSTALLED_APPS:
Example:
INSTALLED_APPS = (
...
'treasuremap',
...
)
Configuration
Within your settings.py, you’ll need to add a setting (which backend to use, etc).
Example:
TREASURE_MAP = {
'BACKEND': 'treasuremap.backends.google.GoogleMapBackend',
'API_KEY': 'Your API key',
'SIZE': (400, 600),
'MAP_OPTIONS': {
'zoom': 5
}
}
Example usage
In models
from django.db import models
from treasuremap.fields import LatLongField
class ShopModel(models.Model):
name = models.CharField(max_length=100)
point = LatLongField(blank=True)
In forms
from django import forms
from treasuremap.forms import LatLongField
class ShopForm(models.Model):
point = LatLongField()
<head>
...
<!-- jQuery is required; include if need -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
...
</head>
<form method="POST" action=".">
{{ form.media }}
{% csrf_token %}
{{ form.as_p }}
</form>
Depending on what backend you are using, the correct widget will be displayed with a marker at the currently position (jQuery is required).
Settings
Support map:
Google map treasuremap.backends.google.GoogleMapBackend
Yandex map treasuremap.backends.yandex.YandexMapBackend
Other settings:
API_KEY - if need, default None
SIZE - tuple with the size of the map, default (400, 400)
ONLY_MAP - hide field lat/long, default True
MAP_OPTIONS - dict, used to initialize the map, default {'latitude': 51.562519, 'longitude': -1.603156, 'zoom': 5}. latitude and longitude is required, do not use other “LatLong Object”.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_treasuremap-0.2.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fd59177eda5906343e04d7a3d62750a711ce20b0f4a0ed946adafb3026effb2 |
|
MD5 | 0f515e3ef60840cc8d64bae06e6b575c |
|
BLAKE2b-256 | d619af869117d5cb6884ca2af84f28945a0a9924e5488c3cf2e782d27ebe8a3c |