Skip to main content

A django app for store places using Google Maps API

Project description

django-places

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

Badges

PyPI Travis-ci Codacy Badge

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}'

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

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ python runtests.py

Credits

Tools used in rendering this package:

Similar Projects

Changelog

Unreleased

Full Changelog

Implemented enhancements:

  • Update fields.py for Django 3.0 #24 (dryan)

Closed issues:

  • Deprecated Field._get_val_from_obj() #25

v3.1.0 (2018-10-30)

Full Changelog

Implemented enhancements:

  • Support marker options and set marker as draggable #22 (oscarmcm)

Fixed bugs:

  • Empty Map in admin #16

v3.0.0 (2018-10-29)

Full Changelog

Implemented enhancements:

Fixed bugs:

  • Multiple PlacesField() Objects declaration in one Model clones data from one Object to the other. #14
  • Remove jquery geocomplete #19 (oscarmcm)

v2.0.0 (2017-09-10)

Full Changelog

Implemented enhancements:

Fixed bugs:

  • Django 1.11 not render widget #9

v1.1.4 (2017-05-08)

Full Changelog

Fixed bugs:

  • undefined name Location #10

v1.1.3 (2017-05-07)

Full Changelog

Fixed bugs:

  • Kwargs problem #8
  • Problems with djplaces #6
  • i18n support #3

v1.1.2 (2017-05-07)

Full Changelog

v1.1.1 (2017-01-22)

Full Changelog

v1.1.0 (2017-01-09)

Full Changelog

v1.0.5 (2016-07-26)

Full Changelog

Implemented enhancements:

  • Add own jquery to avoid conflicts and be able to used in admin and templates #5 (darwing1210)

v1.0.4 (2016-07-20)

Full Changelog

v1.0.3 (2016-06-01)

Full Changelog

v1.0.2 (2016-05-12)

Full Changelog

v1.0.1 (2016-05-12)

Full Changelog

Fixed bugs:

  • Geocomplete is not a function #1

Merged pull requests:

  • Fixes #1 Geocomplete is not a function #2 (oscarmcm)

v1.0.0 (2016-04-28)

Full Changelog

* This Changelog was automatically generated by github_changelog_generator

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-4.0.0.tar.gz (8.8 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-4.0.0-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dj-places-4.0.0.tar.gz.

File metadata

  • Download URL: dj-places-4.0.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for dj-places-4.0.0.tar.gz
Algorithm Hash digest
SHA256 ad30d8ade767ff6e69d2c8c0a7b97f84ee86dc0322a4f5b855cbafed7642d9ce
MD5 493546377557476cc1d28326d8a7ecbd
BLAKE2b-256 82ab9dc5f3a1ba66719c174bad87c8011f95210ba202a8f3ac4850b420330517

See more details on using hashes here.

File details

Details for the file dj_places-4.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: dj_places-4.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for dj_places-4.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a1d4e8cf3d8b67de93dd17bfc905f10c238f30a08219c04029979b053789d84d
MD5 f98cd969f105dcdad601a5297c0b6b60
BLAKE2b-256 cf65620c5176e7f5639699c27f8ac6aec017b6bb7dea2f7ee4af7057e9eddee3

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