Countries

Although for the most countries, sovereignty is not disputed, there are numerous cases where the definition of country is not clear. Using the full ISO 3166-1 country list may seem the most political correct method, but this would also include uninhabited wasteland such as Antartica and Norfolk Island. Furthermore, some territories are more or less part of another country, such as Greenland that is part of Denmark.

To accommodate for these differences, this module chooses to include the following countries by default:

  • All UN member states
  • All UN disputed states (except for when no ISO 3166-1 country code is available)
  • All UN observer states
  • All UN non-self-governing states (this list is rather arbitrary, unfortunately)

Both fields provided by this module provide ways to manually add or exclude items from this list, as long as they are valid ISO 3166-1 alpha-2 codes.

The list of ISO 3166-1 countries included with this module uses the common names of countries, rather than using their official names.

Note

While this module tries to provide some sort of equal ground most people would agree on, the choices that have been made may be grounds for disputes on sovereignty. First of all, I’m sorry if the choices that have been made make you feel uncomfortable. Second of all, you are not required to use the provided default list and you can easily include or exclude countries to your liking. And finally, you are welcome to open a ticket (or pull request) on Github, but please keep it civilized and try to maintain a unbiased position.

class internationalflavor.countries.models.CountryField(countries=None, exclude=None, *args, **kwargs)

A model field that allows users to choose their country. By default, it lists all countries recognized by the UN, but using the countries attribute you can specify your own set of allowed countries. Use exclude to exclude specific countries.

class internationalflavor.countries.forms.CountryFormField(countries=None, exclude=None, *args, **kwargs)

A form field that allows users to choose their country. By default, it lists all countries recognized by the UN, but using the countries attribute you can specify your own set of allowed countries. Use exclude to exclude specific countries.

Data constants

You can use the following constants to specify your own set of available countries.

internationalflavor.countries.data.UN_MEMBER_STATES = (...)

List of UN Member States Source: http://www.un.org/en/members/index.shtml

internationalflavor.countries.data.UN_OBSERVER_STATES = (...)

List of UN Observer States Source: http://www.un.org/en/members/nonmembers.shtml

internationalflavor.countries.data.UN_DISPUTED_STATES = (...)

Disputed UN states.

Source: https://en.wikipedia.org/wiki/List_of_sovereign_states#List_of_states

No ISO 3166-1 code has yet been assigned, and thus not included, for:

  • Abkhazia
  • Nagorno-Karabakh
  • Northern Cyprus
  • Sahrawi Arab Democratic Republic
  • Somaliland
  • South Ossetia
  • Transnistria

Although Kosovo has no ISO 3166-1 code either, it is generally accepted to be XK temporarily; see http://ec.europa.eu/budget/contracts_grants/info_contracts/inforeuro/inforeuro_en.cfm or the CLDR

internationalflavor.countries.data.UN_NON_SELF_GOVERNING_STATES = (...)

List of the (rather arbitrary) UN non-self-governing states

Source: http://www.un.org/en/decolonization/nonselfgovterritories.shtml

internationalflavor.countries.data.UN_RECOGNIZED_COUNTRIES = (...)

Combined list of all UN_* data constants.

internationalflavor.countries.data.IOC_RECOGNIZED_COUNTRIES = (...)

List of countries as defined by IOC.

Source: https://en.wikipedia.org/wiki/Comparison_of_IOC,_FIFA,_and_ISO_3166_country_codes

Comparison with other packages

django-countries
This module has a more elaborate CountryField. It returns Country objects instead of ISO 3166-1 alpha-2 codes that allow easy access to the full name of a country or its country flag. However, it only provides the basic ISO country code list, with official country names (rather than using their common names).

See also

UN member states
List of UN member states.
UN observer states
List of UN observer states
UN non-self-governing states
List of UN non-self-governing states
Wikpedia: List of ISO 3166-1 alpha-2 codes
List of all ISO 3166-1 alpha-2 codes.
Wikipedia: List of sovereign states
List of disputed sovereign states.
Wikipedia: Comparison of IOC ... country codes
List of countries as recognized by the IOC.