Skip to content

majerteam/emencia-django-french_zones

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emencia Django French Zones

French regions and departments utilities for your Django projects.

You could retrieve the last sources from http://github.com/Fantomas42/emencia-django-french_zones and running the installation script

$> python setup.py install

or use pip

$> pip install -e git://github.com/Fantomas42/emencia-django-french_zones.git#egg=emencia.django.french_zones

Register emencia.django.french_zones in your INSTALLED_APPS section your project settings.

>>> INSTALLED_APPS = (
...   # Your favorites apps
...   'emencia.django.french_zones',
... )

Now you can run a syncdb for installing the models into your database and all the french regions with her departments associated contained in a fixture.

With the fixture loaded on the database you can easily retrieve the Department and the Region associated with a french postal code.

>>> from emencia.django.french_zones.utils import get_region_from_postal_code
>>> from emencia.django.french_zones.utils import get_department_from_postal_code

>>> get_department_from_postal_code('62138')
... <Department: Pas-de-Calais>

>>> get_region_from_postal_code('62138')
... <Region: Nord Pas-de-Calais>

About

French regions and departments utilities for your Django projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%