skip to navigation
skip to content

Not Logged In

django-postal 0.93

A Django app for l10n of postal addresses.

Latest Version: 0.96


(Based upon

WARNING: This project is in ALPHA mode and the API is in flux.

A django application that provides a location agnostic model for postal addresses.

The motivation behind this project is that most countries have different forms of
postal addresses e.g. ,

This app assumes that all postal addresses worldwide can be made up of 5 optional
address lines plus a country code.

It then localizes the title of each line dependant on the country selected.
Further information on each address line can be gleaned from
django.contrib.localflavor fields and widgets e.g. for the UK

from django import forms
from django.utils.translation import ugettext_lazy as _
from import UKPostcodeField, UKCountySelect

from postal.forms import PostalAddressForm

class GBPostalAddressForm(PostalAddressForm):
line1 = forms.CharField(label=_(u"Street"), required=False, max_length=50)
line2 = forms.CharField(label=_(u"Area"), max_length=50)
city = forms.CharField(label=_(u"Town"), max_length=50)
state = forms.CharField(label=_(u"County"), widget=UKCountySelect, max_length=50)
code = UKPostcodeField(label=_(u"Postcode"))

It is hoped that various contributors will contribute address formats per country
and that eventually this address information could find it's way back in to


django-countries (


1. Add django-countries and django-postal to your INSTALLED_APPS in


3. Add a postal_form to your templates

{% load postal_tags %}
<script src="{{ MEDIA_URL }}js/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<form method="POST" action="">
{% csrf_token %}
{% monitor_country_change %}
<script type="text/javascript">
<input type="submit"/>
Changing the country in the form above should localise the address form.

3. In your view code add code to save the addressform e.g.

from postal.forms import PostalAddressForm

def my_view(request)
if request.method == "POST":
address_form = PostalAddressForm(request.POST, prefix=request.POST.get('prefix', ''))

How to use localised addresses

Address localisation is turned on by default.
To turn off Address l10n: in set

Customize address labels and requirement

If you wish to customize the address labels and whether the address line is
required or not, you can add the following variables to

each of these variables is set to a tuple of the format ('label', True/False)
'label' is used to label the field, and the second boolean value sets whether
the field is required or not, e.g.
POSTAL_ADDRESS_LINE1 = ("Department", True)


Major refactor where all models removed so django-postal just provides localized forms.
It is up to the supporting project to define their own address models

Don't enforce uniqueness on postal addresses

Developers, How to Contribute
$ git clone
$ cd django-postal
$ virtualenv . --no-site-packages
$ source bin/activate
$ python
$ bin/buildout -v
$ bin/django syncdb
$ bin/django test postal
$ bin/django runserver

browse to http://localhost:8000

new countries can be added to the src/postal/forms folder by their
2 letter country code e.g. us

Each country folder contains an and a contains the localized address  
File Type Py Version Uploaded on Size
django-postal-0.93.tar.gz (md5) Source 2012-09-11 10KB
  • Downloads (All Versions):
  • 87 downloads in the last day
  • 482 downloads in the last week
  • 2172 downloads in the last month