Giter Club home page Giter Club logo

django-location-field's Introduction

Django Location Field

Let users pick locations using a map widget and store its latitude and longitude.

Stable version: 1.6.1
Beta version: 2.0.0b0

License: MIT

Development Notice

The master branch contains unstable code for the 2.x release, that is not ready for production.

You must refer to the 1.6.1 tag for a stable release.

Status

Build Status

Tests are performed with Python 2.7, Django 1.7 1.8 and SpatiaLite. We'd like to have automated tests for Python 3 too, but it looks like pysqlite (which is used for testing) does not support it yet, so it's blocking us. You can get more details in the tox.ini file.

Features

  • Support for multiple map engines, like Google Maps, OpenStreetMap and Mapbox.
  • Works with both Spatial and non-Spatial databases.

Compatibility

  • Django 1.7 to 1.9
  • Python 2.7 to 3.5

Spatial Databases

  • PostGIS
  • SpatiaLite

Installation

  1. Install through pip (or manually place it on your PYTHONPATH).

    pip install django-location-field

  2. Add location_field.apps.DefaultConfig to INSTALLED_APPS your settings.py file

For example, PostGIS:

https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/postgis/

Basic usage (using Spatial Database)

from django.contrib.gis.db import models
from django.contrib.gis.geos import Point
from location_field.models.spatial import LocationField

class Place(models.Model):
    city = models.CharField(max_length=255)
    location = LocationField(based_fields=['city'], zoom=7, default=Point(1.0, 1.0))
    objects = models.GeoManager()

Look that you must put models.GeoManager() in your model, or some errors will occur.

Basic usage (without Spatial Database)

from django.db import models
from location_field.models.plain import PlainLocationField

class Place(models.Model):
    city = models.CharField(max_length=255)
    location = PlainLocationField(based_fields=['city'], zoom=7)

Screenshot

Screenshot

django-location-field's People

Contributors

caioariede avatar mariocesar avatar angvp avatar kami avatar hirunatan avatar arcticlinux avatar camilonova avatar mixser avatar czpython avatar undernewmanagement avatar litchfield avatar shayh avatar voodmania avatar

Watchers

James Cloos avatar Benedikt Breinbauer avatar Alexander Wolf avatar Dennis Pratter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.