Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

django application to manage administrative geographical info (country, city, region ...)

branch: develop

minor fixes

latest commit 4aa04971d2
authored April 02, 2014
Octocat-spinner-32 datas added some fixtures June 12, 2012
Octocat-spinner-32 demo bug fixes January 02, 2014
Octocat-spinner-32 docs updates README January 04, 2014
Octocat-spinner-32 geo django 1.7 compat April 02, 2014
Octocat-spinner-32 tests minor fixes April 02, 2014
Octocat-spinner-32 .gitignore updates .gitignore January 02, 2014
Octocat-spinner-32 .travis.yml django 1.7 compat April 02, 2014
Octocat-spinner-32 AUTHORS reinit May 15, 2012
Octocat-spinner-32 CHANGES updates CHANGES February 17, 2014
Octocat-spinner-32 LICENSE fixed LICENSE September 03, 2012
Octocat-spinner-32 MANIFEST.in fixes MANIFEST October 27, 2013
Octocat-spinner-32 Makefile django 1.7 compat April 02, 2014
Octocat-spinner-32 README.rst updates README January 04, 2014
Octocat-spinner-32 conftest.py update requirements January 03, 2014
Octocat-spinner-32 setup.py * fixed migrations October 18, 2013
Octocat-spinner-32 tox.ini minor fixes April 02, 2014
README.rst

django-geo

A Django application which manage administrative geographical data. It use Modified Preorder Tree Traversal, provided by django-mptt https://github.com/django-mptt/django-mptt/

Geo is not intented to replace a GIS, but to manage all the cases where you have administrative trees, with a strict/lazy hierarchy.

Models

  • Country
  • Area
  • Location
  • AdministrativeAreaType
  • Currency

Examples

Three levels
italy = Country.objects.get(iso_code='IT')
regione, __ = italy.administrativeareatype_set.get_or_create(name='Regione')
provincia,__ = italy.administrativeareatype_set.get_or_create(name='Provincia',
                                                              parent=regione)
comune, __= italy.administrativeareatype_set.get_or_create(name='Comune',
                                                           parent=provincia)
lazio, __ = AdministrativeArea.objects.get_or_create(country=italy,
                                                     name ='Lazio',
                                                     type=regione)
roma_provincia, __ = AdministrativeArea.objects.get_or_create(country=italy,
                                                              name ='Provincia di Roma',
                                                              type=provincia,
                                                              parent=lazio)
roma_comune, __ = AdministrativeArea.objects.get_or_create(country=italy,
                                                            name ='Comune di Roma',
                                                            type=comune,
                                                            parent=roma_provincia)
city, __ = LocationType.objects.get_or_create(description='CITY')
roma, __  = Location.objects.get_or_create(country=italy,
                                            name ='Roma',
                                            type=city,
                                            area=roma_comune)

Two levels

us = Country.objects.get(iso_code='US')
state, __ = italy.administrativeareatype_set.get_or_create(name='State')
county,__ = italy.administrativeareatype_set.get_or_create(name='County',
                                                            parent=state)
ny, __ = AdministrativeArea.objects.get_or_create(country=us,
                                                    name ='New York',
                                                    type=state)
columbia, __ = AdministrativeArea.objects.get_or_create(country=us,
                                                        name ='Columbia',
                                                        type=county,
                                                        parent=ny)
city, __ = LocationType.objects.get_or_create(description='CITY')
hudson, __  = Location.objects.get_or_create(country=us,
                                             name ='Hudson',
                                             type=city,
                                             area=columbia,
                                             is_administrative=True)

Links

Stable master-build master-cov Requirements Status
Development dev-build dev-cov Requirements Status
Project home page: https://github.com/saxix/django-geo
Issue tracker: https://github.com/saxix/django-geo/issues?sort
Download: http://pypi.python.org/pypi/django-geo/
Documentation: https://django-geo.readthedocs.org/en/latest/
Something went wrong with that request. Please try again.