Skip to main content

A Django application which manage administrative geographical data.

Project description

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)

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

django-geo-0.7b1.tar.gz (24.4 kB view details)

Uploaded Source

File details

Details for the file django-geo-0.7b1.tar.gz.

File metadata

  • Download URL: django-geo-0.7b1.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-geo-0.7b1.tar.gz
Algorithm Hash digest
SHA256 cf8c8a9061fec476e34bc61dd8383152d928b46921f400ba40226bae042720ff
MD5 09508b4836d7547a79c76888c3c205ad
BLAKE2b-256 36eefa822c9f9a3b839ca6c62e83221f1110fd6650425684fb2e4173307a4b81

See more details on using hashes here.

Provenance

Supported by

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