A fork of http://bitbucket.org/smileychris/django-countries/ for individual changes and updates.
Switch branches/tags
upstream/1.0.5 hudson-django-countries-54 hudson-django-countries-53 hudson-django-countries-52 hudson-django-countries-51 hudson-django-countries-51-SUCCESS hudson-django-countries-50 hudson-django-countries-49 hudson-django-countries-48 hudson-django-countries-48-SUCCESS hudson-django-countries-47 hudson-django-countries-47-SUCCESS hudson-django-countries-46 hudson-django-countries-46-SUCCESS hudson-django-countries-45 hudson-django-countries-45-SUCCESS hudson-django-countries-44 hudson-django-countries-44-SUCCESS hudson-django-countries-43 hudson-django-countries-43-SUCCESS hudson-django-countries-42 hudson-django-countries-42-SUCCESS hudson-django-countries-41 hudson-django-countries-40 hudson-django-countries-39 hudson-django-countries-38 hudson-django-countries-38-SUCCESS hudson-django-countries-37 hudson-django-countries-36 hudson-django-countries-36-SUCCESS hudson-django-countries-35 hudson-django-countries-7 hudson-django-countries-6 hudson-django-countries-6-SUCCESS hudson-django-countries-5 hudson-django-countries-4 hudson-django-countries-4-SUCCESS hudson-django-countries-3 hudson-django-countries-3-SUCCESS hudson-django-countries-2 hudson-django-countries-2-SUCCESS hudson-django-countries-1 debian/1.0.5-0sg54 debian/1.0.5-0sg53 debian/1.0.5-0sg52 debian/1.0.5-0sg51 debian/1.0.5-0sg48 debian/1.0.5-0sg47 debian/1.0.5-0sg46 debian/1.0.5-0sg45 debian/1.0.5-0sg44 debian/1.0.5-0sg43 debian/1.0.5-0sg42 debian/1.0.5-0sg41 debian/1.0.5-0sg40 debian/1.0.5-0sg39 debian/1.0.5-0sg38 debian/1.0.5-0sg37 debian/1.0.5-0sg36 debian/1.0.5-0sg7 debian/1.0.5-0sg6 debian/1.0.5-0sg5 debian/1.0.5-0sg4 debian/1.0.5-0sg3 debian/1.0.5-0sg2
Nothing to show
Pull request Compare This branch is 23 commits ahead, 6 commits behind degenhard:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A Django application which provides country choices for use with forms, and
a country field for models.

To use the flags, you will want to copy the flags directory of
``django_countries/media`` to your static files directory, or use the
`django-staticfiles`_ application.

.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles/


A country field for Django models that provides all ISO 3166-1 countries as

``CountryField`` is based on Django's ``CharField``, providing choices
corresponding to the official ISO 3166-1 list of countries (with a default
``max_length`` of 2).

Consider the following model using a ``CountryField``::

    from django.db import models
    from django_countries import CountryField

    class Person(models.Model):
        name = models.CharField(max_length=100)
        country = CountryField()

Any ``Person`` instance will have a ``country`` attribute that you can use to
get details of the person's country:

>>> person = Person(name='Chris', country='NZ')
>>> person.country
>>> person.country.name
u'New Zealand'
>>> person.country.flag

This object (``person.country`` in the example) is a ``Country`` instance,
which is described below.

The ``Country`` object

An object used to represent a country, instanciated with a two character
country code.

It can be compared to other objects as if it was a string containing the
country code, and it's ``__unicode__`` method returns the country code.  

  Contains the full country name.

  Contains a URL to the flag. ``'flags/[lowercasecountrycode].gif'`` is
  appended to the ``STATIC_URL`` setting, or if that isn't set, the
  ``MEDIA_URL`` setting.

Country Choices

The ``django_countries.countries`` module contains some constants which can be
used to generate choices lists for a Django ``Select`` form field.

  A tuple of two part tuples, each consisting of a country code and the
  corresponding nicely titled (and translatable) country name.

  A tuple, similar to ``COUNTRIES``, but also includes duplicates for countries
  that contain a comma (i.e. the non-comma'd version).

  A dictionary where each key is a country code and each value is the
  corresponding official capitalised ISO 3166-1 English country name.