Changelogs >


PyUp actively tracks 429,349 Python packages for vulnerabilities to keep your Python environments secure.

Scan your dependencies



- Nothing changed yet.



- Fix slowdown introduced in v7.3 caused by always using country name lookups
for field comparisons. ``filter(country="New Zealand")`` will no longer match
now, but instead new ``__name`` and ``__iname`` filters have been added to
achieve this.



- Typing compatibility fixes for Python <3.9.



- Make full English country names work in database lookups, for example,



- Fix Latin translations.



- Allow the character field to work with custom country codes that are not 2
characters (such as "GB-WLS").

- Fix compatibility with ``django-migrations-ignore-attrs`` library.



- Allow customising the ``str_attr`` of Country objects returned from a
CountryField via a new ``countries_str_attr`` keyword argument (thanks C.

- Add ``pyuca`` as an extra dependency, so that it can be installed like
``pip install django-countries[pyuca]``.

- Add Django 3.2 support.



- Add ``name_only`` as an option to the Django Rest Framework serializer field
(thanks Miguel Marques).

- Add in Python typing.

- Add Python 3.9, Django 3.1, and Django Rest Framework 3.12 support.

- Drop Python 3.5 support.

- Improve IOC code functionality, allowing them to be overridden in
``COUNTRIES_OVERRIDE`` using the complex dictionary format.



- Update flag of Mauritania.

- Add flag for Kosovo (under its temporary code of XK).



- Fix Python 3.5 syntax error (no f-strings just yet...).



- Change ISO country import so that "Falkland Islands [Malvinas]" => "Falkland Islands (Malvinas)".



- Add a GraphQL object type for a django ``Country`` object.



- Make DRF CountryField respect ``blank=False``. This is a backwards incompatible change since blank input will now
return a validation error (unless ``blank`` is explicitly set to ``True``).

- Fix ``COUNTRIES_OVERRIDE`` when using the complex dictionary format and a single name.

- Add bandit to the test suite for basic security analysis.

- Drop Python 2.7 and Python 3.4 support.

- Add Rest Framework 3.10 and 3.11 to the test matrix, remove 3.8.

- Fix a memory leak when using PyUCA. Thanks Meiyer (aka interDist)!



- Django 3.0 compatibility.

- Plugin system for extending the ``Country`` object.



- Renamed Macedonia -> North Macedonia.

- Fix an outlying ``makemigrations`` error.

- Pulled in new translations which were provided but missing from previous

- Fixed Simplified Chinese translation (needed to be ``locale/zh_Hans``).

- Introduce an optional complex format for ``COUNTRIES_ONLY`` and
``COUNTRIES_OVERRIDE`` to allow for multiple names for a country, a custom
three character code, and a custom numeric country code.



- Add test coverage for Django Rest Framework 3.9.



- Tests for Django 2.1 and Django Rest Framework 3.8.



- Fix ``dumpdata`` and ``loaddata`` for ``CountryField(multiple=True)``.



- Iterating a ``Countries`` object now returns named tuples. This makes things
nicer when using ``{% get_countries %}`` or using the country list elsewhere
in your code.



- Ensure Django 2.1 compatibility for ``CountrySelectWidget``.

- Fix regression introduced into 5.1 when using Django 1.8 and certain queryset
lookup types (like ``__in``).



- Fix some translations that were included in 5.1 but not compiled.



* Tests now also cover Django Rest Framework 3.7 and Django 2.0.

* Allow for creating country fields using (valid) alpha-3 or numeric codes.

* Fix migration error with blank default (thanks Jens Diemer).

* Add a ``{% get_countries %}`` template tag (thanks Matija Čvrk).



* No longer allow ``multiple=True`` and ``null=True`` together. This causes
problems saving the field, and ``null`` shouldn't really be used anyway
because the country field is a subclass of ``CharField``.



* Use transparency layer for flag sprites.



* Fix invalid reStructuredText in CHANGES.



* Add a ``CountryFieldMixin`` Django Rest Framework serializer mixin that
automatically picks the right field type for a ``CountryField`` (both single
and multi-choice).

* Validation for Django Rest Framework field (thanks Simon Meers).

* Allow case-insensitive ``.by_name()`` matching (thanks again, Simon).

* Ensure a multiple-choice ``CountryField.max_length`` is enough to hold all

* Fix inefficient pickling of countries (thanks Craig de Stigter for the report
and tests).

* Stop adding a blank choice when dealing with a multi-choice ``CountryField``.

* Tests now cover multiple Django Rest Framework versions (back to 3.3).



* Change rest framework field to be based on ``ChoiceField``.

* Allow for the rest framework field to deserialize by full country name
(specifically the English name for now).



* Fix for broken CountryField on certain models in Django 1.11.
Thanks aktiur for the test case.

* Update tests to cover Django 1.11



* Handle "Czechia" translations in a nicer way (fall back to "Czech Republic"
until new translations are available).

* Fix for an import error in Django 1.9+ due to use of non-lazy ``ugettext`` in
the django-countries custom admin filter.

* Back to 100% test coverage.



* Add sprite flag files (and ``Country.flag_css`` property) to help minimize
HTTP requests.



* Better default Django admin filter when filtering a country field in a

* Fix settings to support Django 1.11

* Fix when using a model instance with a deferred country field.

* Allow ``CountryField`` to handle multiple countries at once!

* Allow CountryField to still work if Deferred.

* Fix a field with customized country list. Thanks pilmie!



* Fix tests for ``COUNTRIES_FIRST_SORT`` (feature still worked, tests didn't).





* Fix minor packaging error.



* Extend test suite to cover Django 1.8

* Fix XSS escaping issue in CountrySelectWidget

* Common name changes: fix typo of Moldova, add United Kingdom

* Add ``{% get_country %}`` template tag.

* New ``CountryField`` Django Rest Framework serializer field.


Not secure

* Add the attributes to ``Countries`` class that can override the default

* CountriesField can now be passed a custom countries subclass to use, which
combined with the previous change allows for different country choices for
different fields.

* Allow ``COUNTRIES_ONLY`` to also accept just country codes in its list
(rather than only two-tuples), looking up the translatable country name from
the full country list.

* Fix Montenegro flag size (was 12px high rather than the standard 11px).

* Fix outdated ISO country name formatting for Bolivia, Gambia, Holy See,
Iran, Micronesia, and Venezuela.


Not secure

* Fixes initial iteration failing for a fresh ``Countries`` object.

* Fix widget's flag URLs (and use ensure widget is HTML encoded safely).

* Add ``countries.by_name(country, language='en')`` method, allowing lookup of
a country code by its full country name. Thanks Josh Schneier.


Not secure

* Packaging fix (``CHANGES.rst`` wasn't in the manifest)


Not secure

* Start change log :)

* Add a ``COUNTRIES_FIRST`` setting (and some other related ones) to allow for
specific countries to be shown before the entire alphanumeric list.

* Add a ``blank_label`` argument to ``CountryField`` to allow customization of
the label shown in the initial blank choice shown in the select widget.


Not secure

* Fix ``CountrySelectWidget`` failing when used with a model form that is
passed a model instance.


Not secure

* Revert descriptor to always return a Country object.

* Fix the ``CountryField`` widget choices appearing empty due to a translation
change in v3.0.


Not secure

Django supported versions are now 1.4 (LTS) and 1.6+

* Add ``COUNTRIES_ONLY`` setting to restrict to a specific list of countries.

* Optimize country name translations to avoid exessive translation calls that
were causing a notable performance impact.

* PyUCA integration, allowing for more accurate sorting across all locales.
Also, a better sorting method when PyUCA isn't installed.

* Better tests (now at 100% test coverage).

* Add a ``COUNTRIES_FLAG_URL`` setting to allow custom flag urls.

* Support both IOC and numeric country codes, allowing more flexible lookup of
countries and specific code types.

* Field descriptor now returns ``None`` if no country matches (*reverted in


Not secure

* Fix Python 3 compatibility.


Not secure

* Fix issue with translations getting evaluated early.


Not secure

* Add IOC (3 letter) country codes.

* Fix bug when loading fixtures.


Not secure

This is the first entry to the change log. The previous was 1.5,
released 19 Nov 2012.

* Optimized flag images, adding flags missing from original source.

* Better storage of settings and country list.

* New country list format for fields.

* Better tests.



* Drop legacy code

* Fix tests, 100% coverage

* IOS / OSX unicode flags function

* Fix widget choices on Django 1.9+

* Add ``COUNTRIES_FIRST_SORT``. Thanks Edraak!