Skip to main content

A django app for store places using Google Maps API

Project description

django-places

PyPI

A Django app for store places with autocomplete function and a related map to the selected place.

Quickstart


Install dj-places and add it to your installed apps:

$ pip install dj-places
    INSTALLED_APPS = (
    	...
    	'places',
    	...
    )

Add the following settings and maps api key (read more here):

PLACES_MAPS_API_KEY='YourAwesomeUltraSecretKey'
PLACES_MAP_WIDGET_HEIGHT=480
PLACES_MAP_OPTIONS='{"center": { "lat": 38.971584, "lng": -95.235072 }, "zoom": 10}'
PLACES_MARKER_OPTIONS='{"draggable": true}'

Usage


Then use it in a project:

from django.db import models
from places.fields import PlacesField


class MyLocationModel(models.Model):
    location = PlacesField()

This enables the following API:

    >>> from myapp.models import ModelName
    >>> poi = ModelName.objects.get(id=1)
    >>> poi.position
    Place('Metrocentro, Managua, Nicaragua', 52.522906, 13.41156)
    >>> poi.position.place
    'Metrocentro, Managua, Nicaragua'
    >>> poi.position.latitude
    52.522906
    >>> poi.position.longitude
    13.41156

For using outside the Django Admin:

<form method="post">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="Save">
    {{ form.media }}
</form>

Remember to add the {{ form.media }} in your template.

Demo


Credits


Tools used in rendering this package:

Similar Projects


Project details


Download files

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

Source Distribution

dj_places-5.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

dj_places-5.2.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file dj_places-5.2.0.tar.gz.

File metadata

  • Download URL: dj_places-5.2.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for dj_places-5.2.0.tar.gz
Algorithm Hash digest
SHA256 81b89ed9c94ba421f7e9256adfa980fc3dbf884f2e643af689421134a636a7c2
MD5 45b2e6d7c59063a074faad70575c3414
BLAKE2b-256 3b97d9a93a1173c69ef227ad208c27d172c54727eb66de7f5e5a88a65e4ec6f0

See more details on using hashes here.

File details

Details for the file dj_places-5.2.0-py3-none-any.whl.

File metadata

  • Download URL: dj_places-5.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for dj_places-5.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32549ae88ac06347b14213ef11ac8561ff7b6cc609acafe99ab2dd70f575667a
MD5 0478f3b1a71f8dfbf1c446a017ec3674
BLAKE2b-256 88fd0dc68c43176376811993831472c4c1426873db1b701e76b8f07229d45280

See more details on using hashes here.

Supported by

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