[Python-modules-commits] [django-countries] 01/02: Import django-countries_3.3.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Fri Oct 23 07:04:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch upstream
in repository django-countries.
commit e624bc862bd399b85254e565467c6c6e2c8fb264
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Tue Oct 13 08:45:51 2015 +0200
Import django-countries_3.3.orig.tar.gz
---
CHANGES.rst | 128 +++
MANIFEST.in | 2 +-
PKG-INFO | 229 ++++-
README.rst | 96 ++
django_countries.egg-info/PKG-INFO | 229 ++++-
django_countries.egg-info/SOURCES.txt | 21 +-
django_countries/__init__.py | 245 ++++-
django_countries/conf.py | 45 +
django_countries/data.py | 378 ++++++-
django_countries/fields.py | 136 ++-
django_countries/ioc_data.py | 16 +-
django_countries/locale/ar/LC_MESSAGES/django.mo | Bin 0 -> 14901 bytes
django_countries/locale/ar/LC_MESSAGES/django.po | 1072 +++++++++++++++++++
django_countries/locale/cs/LC_MESSAGES/django.mo | Bin 12246 -> 12779 bytes
django_countries/locale/cs/LC_MESSAGES/django.po | 606 ++++++-----
django_countries/locale/de/LC_MESSAGES/django.mo | Bin 11828 -> 11404 bytes
django_countries/locale/de/LC_MESSAGES/django.po | 607 ++++++-----
django_countries/locale/el/LC_MESSAGES/django.mo | Bin 15097 -> 14969 bytes
django_countries/locale/el/LC_MESSAGES/django.po | 606 ++++++-----
django_countries/locale/en/LC_MESSAGES/django.mo | Bin 378 -> 378 bytes
django_countries/locale/en/LC_MESSAGES/django.po | 584 ++++++-----
django_countries/locale/eo/LC_MESSAGES/django.mo | Bin 0 -> 12297 bytes
.../locale/{it => eo}/LC_MESSAGES/django.po | 1083 ++++++++++----------
django_countries/locale/es/LC_MESSAGES/django.mo | Bin 10597 -> 12594 bytes
django_countries/locale/es/LC_MESSAGES/django.po | 646 ++++++------
django_countries/locale/fa/LC_MESSAGES/django.mo | Bin 0 -> 12983 bytes
.../locale/{it => fa}/LC_MESSAGES/django.po | 1082 +++++++++----------
django_countries/locale/fi/LC_MESSAGES/django.mo | Bin 10327 -> 10106 bytes
django_countries/locale/fi/LC_MESSAGES/django.po | 600 ++++++-----
django_countries/locale/fr/LC_MESSAGES/django.mo | Bin 10555 -> 12796 bytes
django_countries/locale/fr/LC_MESSAGES/django.po | 663 ++++++------
django_countries/locale/hr/LC_MESSAGES/django.mo | Bin 10568 -> 10286 bytes
django_countries/locale/hr/LC_MESSAGES/django.po | 598 ++++++-----
django_countries/locale/it/LC_MESSAGES/django.mo | Bin 10153 -> 12500 bytes
django_countries/locale/it/LC_MESSAGES/django.po | 655 ++++++------
django_countries/locale/ja/LC_MESSAGES/django.mo | Bin 13616 -> 13687 bytes
django_countries/locale/ja/LC_MESSAGES/django.po | 610 ++++++-----
django_countries/locale/nb/LC_MESSAGES/django.mo | Bin 11674 -> 12255 bytes
django_countries/locale/nb/LC_MESSAGES/django.po | 604 ++++++-----
django_countries/locale/nl/LC_MESSAGES/django.mo | Bin 10568 -> 11883 bytes
django_countries/locale/nl/LC_MESSAGES/django.po | 629 ++++++------
django_countries/locale/pl/LC_MESSAGES/django.mo | Bin 11778 -> 11872 bytes
django_countries/locale/pl/LC_MESSAGES/django.po | 605 ++++++-----
.../locale/pt_BR/LC_MESSAGES/django.mo | Bin 10498 -> 11942 bytes
.../locale/pt_BR/LC_MESSAGES/django.po | 632 ++++++------
.../locale/pt_PT/LC_MESSAGES/django.mo | Bin 10611 -> 10347 bytes
.../locale/pt_PT/LC_MESSAGES/django.po | 598 ++++++-----
django_countries/locale/ru/LC_MESSAGES/django.mo | Bin 15020 -> 15722 bytes
django_countries/locale/ru/LC_MESSAGES/django.po | 607 ++++++-----
django_countries/locale/sk/LC_MESSAGES/django.mo | Bin 11881 -> 11936 bytes
django_countries/locale/sk/LC_MESSAGES/django.po | 604 ++++++-----
.../locale/tr_TR/LC_MESSAGES/django.mo | Bin 0 -> 12004 bytes
.../locale/{hr => tr_TR}/LC_MESSAGES/django.po | 965 +++++++++--------
django_countries/locale/uk/LC_MESSAGES/django.mo | Bin 0 -> 15651 bytes
.../locale/{ru => uk}/LC_MESSAGES/django.po | 964 ++++++++---------
django_countries/static/flags/.DS_Store | Bin 12292 -> 0 bytes
django_countries/static/flags/__.gif | Bin 0 -> 3231 bytes
django_countries/static/flags/eu.gif | Bin 0 -> 163 bytes
django_countries/static/flags/ly.gif | Bin 354 -> 202 bytes
django_countries/static/flags/me.gif | Bin 230 -> 330 bytes
django_countries/static/flags/mm.gif | Bin 357 -> 335 bytes
django_countries/tests/custom_countries.py | 5 +
django_countries/tests/forms.py | 24 +
django_countries/tests/models.py | 15 +-
django_countries/tests/settings.py | 5 +
django_countries/tests/settings_lts.py | 6 +
django_countries/tests/test_countries.py | 173 +++-
django_countries/tests/test_fields.py | 173 +++-
django_countries/tests/test_settings.py | 23 +-
django_countries/tests/test_widgets.py | 59 ++
django_countries/widgets.py | 75 ++
setup.py | 26 +-
tox.ini | 53 +-
73 files changed, 10979 insertions(+), 6803 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
new file mode 100644
index 0000000..425aa8c
--- /dev/null
+++ b/CHANGES.rst
@@ -0,0 +1,128 @@
+==========
+Change Log
+==========
+
+This log shows interesting changes that happen for each version, latest
+versions first. It can be assumed that translations have been updated each
+release (and any new translations added).
+
+
+Version 3.3 (30 Mar 2015)
+=========================
+
+* Add the attributes to ``Countries`` class that can override the default
+ settings.
+
+* 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.
+
+
+Version 3.2 (24 Feb 2015)
+=========================
+
+* 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.
+
+
+Version 3.1 (15 Jan 2015)
+=========================
+
+* 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.
+
+Version 3.1.1 (15 Jan 2015)
+---------------------------
+
+* Packaging fix (``CHANGES.rst`` wasn't in the manifest)
+
+
+Version 3.0 (22 Oct 2014)
+=========================
+
+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 v3.0.1*)
+
+Version 3.0.1 (27 Oct 2014)
+---------------------------
+
+* Revert descriptor to always return a Country object.
+
+* Fix the ``CountryField`` widget choices appearing empty due to a translation
+ change in v3.0.
+
+Version 3.0.2 (29 Dec 2014)
+---------------------------
+
+* Fix ``CountrySelectWidget`` failing when used with a model form that is
+ passed a model instance.
+
+
+Version 2.1 (24 Mar 2014)
+=========================
+
+* Add IOC (3 letter) country codes.
+
+* Fix bug when loading fixtures.
+
+Version 2.1.1 (28 Mar 2014)
+---------------------------
+
+* Fix issue with translations getting evaluated early.
+
+Version 2.1.2 (28 Mar 2014)
+---------------------------
+
+* Fix Python 3 compatibility.
+
+
+
+Version 2.0 (18 Feb 2014)
+=========================
+
+This is the first entry to the change log. The previous version 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.
+
+* Changed ``COUNTRIES_FLAG_STATIC`` setting to ``COUNTRIES_FLAG_URL``.
diff --git a/MANIFEST.in b/MANIFEST.in
index 5ffce1e..8289484 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include README.rst
+include *.rst
include LICENSE
include tox.ini
graft django_countries/static/flags
diff --git a/PKG-INFO b/PKG-INFO
index 83ebae1..6169116 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-countries
-Version: 2.1.2
+Version: 3.3
Summary: Provides a country field for Django models.
Home-page: https://github.com/SmileyChris/django-countries/
Author: Chris Beaven
@@ -13,6 +13,12 @@ Description: ================
A Django application that provides country choices for use with forms, flag
icons static files, and a country field for models.
+ Installation
+ ============
+
+ 1. ``pip install django-countries``
+ 2. Add ``django_countries`` to ``INSTALLED_APPS``
+
CountryField
============
@@ -47,6 +53,11 @@ Description: ================
This object (``person.country`` in the example) is a ``Country`` instance,
which is described below.
+ Use ``blank_label`` to set the label for the initial blank choice shown in
+ forms::
+
+ country = CountryField(blank_label='(select country)')
+
The ``Country`` object
----------------------
@@ -62,6 +73,36 @@ Description: ================
flag
Contains a URL to the flag.
+ alpha3
+ The three letter country code for this country.
+
+ numeric
+ The numeric country code for this country (as an integer).
+
+ numeric_padded
+ The numeric country code as a three character 0-padded string.
+
+ ``CountrySelectWidget``
+ -----------------------
+
+ A widget is included that can show the flag image after the select box
+ (updated with JavaScript when the selection changes).
+
+ When you create your form, you can use this custom widget like normal::
+
+ from django_countries.widgets import CountrySelectWidget
+
+ class PersonForm(forms.ModelForm):
+ class Meta:
+ model = models.Person
+ fields = ('name', 'country')
+ widgets = {'country': CountrySelectWidget()}
+
+ Pass a ``layout`` text argument to the widget to change the positioning of the
+ flag and widget. The default layout is::
+
+ '{widget}<img class="country-select-flag" id="{flag_id}" style="margin: 6px 4px 0" src="{country.flag}">'
+
Get the countries from Python
=============================
@@ -109,6 +150,36 @@ Description: ================
'AU': None
}
+ If you have a specific list of countries that should be used, use
+ ``COUNTRIES_ONLY``::
+
+ COUNTRIES_ONLY = ['NZ', 'AU']
+
+ or to specify your own country names, use a dictionary or two-tuple list
+ (string items will use the standard country name)::
+
+ COUNTRIES_ONLY = [
+ 'US',
+ 'UK'
+ ('NZ', _('Middle Earth')),
+ ('AU', _('Desert')),
+ ]
+
+
+ Show certain countries first
+ ----------------------------
+
+ Provide a list of country codes as the ``COUNTRIES_FIRST`` setting and they
+ will be shown first in the countries list (in the order specified) before all
+ the alphanumerically sorted countries.
+
+ By default, these 'first' countries are not repeated again in the
+ alphanumerically sorted list. If you would like them to be repeated, set the
+ ``COUNTRIES_FIRST_REPEAT`` setting to ``True``.
+
+ Finally, you can optionally separate these 'first' countries with an empty
+ choice by providing the choice label as the ``COUNTRIES_FIRST_BREAK`` setting.
+
Customize the flag URL
----------------------
@@ -137,6 +208,161 @@ Description: ================
country = CountryField(
countries_flag_url='//flags.example.com/{code}.png')
+
+ Single field customization
+ --------------------------
+
+ To customize an individual field, rather than rely on project level settings,
+ create a ``Countries`` subclass which overrides settings.
+
+ To override a setting, give the class an attribute matching the lowercased
+ setting without the ``COUNTRIES_`` prefix.
+
+ Then just reference this class in a field. For example, this ``CountryField``
+ uses a custom country list that only includes the G8 countries::
+
+ from django_countries import Countries
+
+ class G8Countries(Countries):
+ only = [
+ 'CA', 'FR', 'DE', 'IT', 'JP', 'RU', 'GB',
+ ('EU', _('European Union'))
+ ]
+
+ class Vote(models.Model):
+ country = CountryField(countries=G8Countries)
+ approve = models.BooleanField()
+
+
+ ==========
+ Change Log
+ ==========
+
+ This log shows interesting changes that happen for each version, latest
+ versions first. It can be assumed that translations have been updated each
+ release (and any new translations added).
+
+
+ Version 3.3 (30 Mar 2015)
+ =========================
+
+ * Add the attributes to ``Countries`` class that can override the default
+ settings.
+
+ * 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.
+
+
+ Version 3.2 (24 Feb 2015)
+ =========================
+
+ * 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.
+
+
+ Version 3.1 (15 Jan 2015)
+ =========================
+
+ * 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.
+
+ Version 3.1.1 (15 Jan 2015)
+ ---------------------------
+
+ * Packaging fix (``CHANGES.rst`` wasn't in the manifest)
+
+
+ Version 3.0 (22 Oct 2014)
+ =========================
+
+ 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 v3.0.1*)
+
+ Version 3.0.1 (27 Oct 2014)
+ ---------------------------
+
+ * Revert descriptor to always return a Country object.
+
+ * Fix the ``CountryField`` widget choices appearing empty due to a translation
+ change in v3.0.
+
+ Version 3.0.2 (29 Dec 2014)
+ ---------------------------
+
+ * Fix ``CountrySelectWidget`` failing when used with a model form that is
+ passed a model instance.
+
+
+ Version 2.1 (24 Mar 2014)
+ =========================
+
+ * Add IOC (3 letter) country codes.
+
+ * Fix bug when loading fixtures.
+
+ Version 2.1.1 (28 Mar 2014)
+ ---------------------------
+
+ * Fix issue with translations getting evaluated early.
+
+ Version 2.1.2 (28 Mar 2014)
+ ---------------------------
+
+ * Fix Python 3 compatibility.
+
+
+
+ Version 2.0 (18 Feb 2014)
+ =========================
+
+ This is the first entry to the change log. The previous version 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.
+
+ * Changed ``COUNTRIES_FLAG_STATIC`` setting to ``COUNTRIES_FLAG_URL``.
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
@@ -147,4 +373,5 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
Classifier: Framework :: Django
diff --git a/README.rst b/README.rst
index 52acafe..f345bf2 100644
--- a/README.rst
+++ b/README.rst
@@ -5,6 +5,12 @@ Django Countries
A Django application that provides country choices for use with forms, flag
icons static files, and a country field for models.
+Installation
+============
+
+1. ``pip install django-countries``
+2. Add ``django_countries`` to ``INSTALLED_APPS``
+
CountryField
============
@@ -39,6 +45,11 @@ get details of the person's country::
This object (``person.country`` in the example) is a ``Country`` instance,
which is described below.
+Use ``blank_label`` to set the label for the initial blank choice shown in
+forms::
+
+ country = CountryField(blank_label='(select country)')
+
The ``Country`` object
----------------------
@@ -54,6 +65,36 @@ name
flag
Contains a URL to the flag.
+alpha3
+ The three letter country code for this country.
+
+numeric
+ The numeric country code for this country (as an integer).
+
+numeric_padded
+ The numeric country code as a three character 0-padded string.
+
+``CountrySelectWidget``
+-----------------------
+
+A widget is included that can show the flag image after the select box
+(updated with JavaScript when the selection changes).
+
+When you create your form, you can use this custom widget like normal::
+
+ from django_countries.widgets import CountrySelectWidget
+
+ class PersonForm(forms.ModelForm):
+ class Meta:
+ model = models.Person
+ fields = ('name', 'country')
+ widgets = {'country': CountrySelectWidget()}
+
+Pass a ``layout`` text argument to the widget to change the positioning of the
+flag and widget. The default layout is::
+
+ '{widget}<img class="country-select-flag" id="{flag_id}" style="margin: 6px 4px 0" src="{country.flag}">'
+
Get the countries from Python
=============================
@@ -101,6 +142,36 @@ For example::
'AU': None
}
+If you have a specific list of countries that should be used, use
+``COUNTRIES_ONLY``::
+
+ COUNTRIES_ONLY = ['NZ', 'AU']
+
+or to specify your own country names, use a dictionary or two-tuple list
+(string items will use the standard country name)::
+
+ COUNTRIES_ONLY = [
+ 'US',
+ 'UK'
+ ('NZ', _('Middle Earth')),
+ ('AU', _('Desert')),
+ ]
+
+
+Show certain countries first
+----------------------------
+
+Provide a list of country codes as the ``COUNTRIES_FIRST`` setting and they
+will be shown first in the countries list (in the order specified) before all
+the alphanumerically sorted countries.
+
+By default, these 'first' countries are not repeated again in the
+alphanumerically sorted list. If you would like them to be repeated, set the
+``COUNTRIES_FIRST_REPEAT`` setting to ``True``.
+
+Finally, you can optionally separate these 'first' countries with an empty
+choice by providing the choice label as the ``COUNTRIES_FIRST_BREAK`` setting.
+
Customize the flag URL
----------------------
@@ -128,3 +199,28 @@ Alternatively, you can specify a different URL on a specific ``CountryField``::
name = models.CharField(max_length=100)
country = CountryField(
countries_flag_url='//flags.example.com/{code}.png')
+
+
+Single field customization
+--------------------------
+
+To customize an individual field, rather than rely on project level settings,
+create a ``Countries`` subclass which overrides settings.
+
+To override a setting, give the class an attribute matching the lowercased
+setting without the ``COUNTRIES_`` prefix.
+
+Then just reference this class in a field. For example, this ``CountryField``
+uses a custom country list that only includes the G8 countries::
+
+ from django_countries import Countries
+
+ class G8Countries(Countries):
+ only = [
+ 'CA', 'FR', 'DE', 'IT', 'JP', 'RU', 'GB',
+ ('EU', _('European Union'))
+ ]
+
+ class Vote(models.Model):
+ country = CountryField(countries=G8Countries)
+ approve = models.BooleanField()
diff --git a/django_countries.egg-info/PKG-INFO b/django_countries.egg-info/PKG-INFO
index 83ebae1..6169116 100644
--- a/django_countries.egg-info/PKG-INFO
+++ b/django_countries.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-countries
-Version: 2.1.2
+Version: 3.3
Summary: Provides a country field for Django models.
Home-page: https://github.com/SmileyChris/django-countries/
Author: Chris Beaven
@@ -13,6 +13,12 @@ Description: ================
A Django application that provides country choices for use with forms, flag
icons static files, and a country field for models.
+ Installation
+ ============
+
+ 1. ``pip install django-countries``
+ 2. Add ``django_countries`` to ``INSTALLED_APPS``
+
CountryField
============
@@ -47,6 +53,11 @@ Description: ================
This object (``person.country`` in the example) is a ``Country`` instance,
which is described below.
+ Use ``blank_label`` to set the label for the initial blank choice shown in
+ forms::
+
+ country = CountryField(blank_label='(select country)')
+
The ``Country`` object
----------------------
@@ -62,6 +73,36 @@ Description: ================
flag
Contains a URL to the flag.
+ alpha3
+ The three letter country code for this country.
+
+ numeric
+ The numeric country code for this country (as an integer).
+
+ numeric_padded
+ The numeric country code as a three character 0-padded string.
+
+ ``CountrySelectWidget``
+ -----------------------
+
+ A widget is included that can show the flag image after the select box
+ (updated with JavaScript when the selection changes).
+
+ When you create your form, you can use this custom widget like normal::
+
+ from django_countries.widgets import CountrySelectWidget
+
+ class PersonForm(forms.ModelForm):
+ class Meta:
+ model = models.Person
+ fields = ('name', 'country')
+ widgets = {'country': CountrySelectWidget()}
+
+ Pass a ``layout`` text argument to the widget to change the positioning of the
+ flag and widget. The default layout is::
+
+ '{widget}<img class="country-select-flag" id="{flag_id}" style="margin: 6px 4px 0" src="{country.flag}">'
+
Get the countries from Python
=============================
@@ -109,6 +150,36 @@ Description: ================
'AU': None
}
+ If you have a specific list of countries that should be used, use
+ ``COUNTRIES_ONLY``::
+
+ COUNTRIES_ONLY = ['NZ', 'AU']
+
+ or to specify your own country names, use a dictionary or two-tuple list
+ (string items will use the standard country name)::
+
+ COUNTRIES_ONLY = [
+ 'US',
+ 'UK'
+ ('NZ', _('Middle Earth')),
+ ('AU', _('Desert')),
+ ]
+
+
+ Show certain countries first
+ ----------------------------
+
+ Provide a list of country codes as the ``COUNTRIES_FIRST`` setting and they
+ will be shown first in the countries list (in the order specified) before all
+ the alphanumerically sorted countries.
+
+ By default, these 'first' countries are not repeated again in the
+ alphanumerically sorted list. If you would like them to be repeated, set the
+ ``COUNTRIES_FIRST_REPEAT`` setting to ``True``.
+
+ Finally, you can optionally separate these 'first' countries with an empty
+ choice by providing the choice label as the ``COUNTRIES_FIRST_BREAK`` setting.
+
Customize the flag URL
----------------------
@@ -137,6 +208,161 @@ Description: ================
country = CountryField(
countries_flag_url='//flags.example.com/{code}.png')
+
+ Single field customization
+ --------------------------
+
+ To customize an individual field, rather than rely on project level settings,
+ create a ``Countries`` subclass which overrides settings.
+
+ To override a setting, give the class an attribute matching the lowercased
+ setting without the ``COUNTRIES_`` prefix.
+
+ Then just reference this class in a field. For example, this ``CountryField``
+ uses a custom country list that only includes the G8 countries::
+
+ from django_countries import Countries
+
+ class G8Countries(Countries):
+ only = [
+ 'CA', 'FR', 'DE', 'IT', 'JP', 'RU', 'GB',
+ ('EU', _('European Union'))
+ ]
+
+ class Vote(models.Model):
+ country = CountryField(countries=G8Countries)
+ approve = models.BooleanField()
+
+
+ ==========
+ Change Log
+ ==========
+
+ This log shows interesting changes that happen for each version, latest
+ versions first. It can be assumed that translations have been updated each
+ release (and any new translations added).
+
+
+ Version 3.3 (30 Mar 2015)
+ =========================
+
+ * Add the attributes to ``Countries`` class that can override the default
+ settings.
+
+ * 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.
+
+
+ Version 3.2 (24 Feb 2015)
+ =========================
+
+ * 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.
+
+
+ Version 3.1 (15 Jan 2015)
+ =========================
+
+ * 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.
+
+ Version 3.1.1 (15 Jan 2015)
+ ---------------------------
+
+ * Packaging fix (``CHANGES.rst`` wasn't in the manifest)
+
+
+ Version 3.0 (22 Oct 2014)
+ =========================
+
+ 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 v3.0.1*)
+
+ Version 3.0.1 (27 Oct 2014)
+ ---------------------------
+
+ * Revert descriptor to always return a Country object.
+
+ * Fix the ``CountryField`` widget choices appearing empty due to a translation
+ change in v3.0.
+
+ Version 3.0.2 (29 Dec 2014)
+ ---------------------------
+
+ * Fix ``CountrySelectWidget`` failing when used with a model form that is
+ passed a model instance.
+
+
+ Version 2.1 (24 Mar 2014)
+ =========================
+
+ * Add IOC (3 letter) country codes.
+
+ * Fix bug when loading fixtures.
+
+ Version 2.1.1 (28 Mar 2014)
+ ---------------------------
+
+ * Fix issue with translations getting evaluated early.
+
+ Version 2.1.2 (28 Mar 2014)
+ ---------------------------
+
+ * Fix Python 3 compatibility.
+
+
+
+ Version 2.0 (18 Feb 2014)
+ =========================
+
+ This is the first entry to the change log. The previous version 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.
+
+ * Changed ``COUNTRIES_FLAG_STATIC`` setting to ``COUNTRIES_FLAG_URL``.
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
@@ -147,4 +373,5 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
Classifier: Framework :: Django
diff --git a/django_countries.egg-info/SOURCES.txt b/django_countries.egg-info/SOURCES.txt
index 291280d..0c2e8fc 100644
--- a/django_countries.egg-info/SOURCES.txt
+++ b/django_countries.egg-info/SOURCES.txt
@@ -1,3 +1,4 @@
+CHANGES.rst
LICENSE
MANIFEST.in
README.rst
@@ -9,11 +10,14 @@ django_countries/data.py
django_countries/fields.py
django_countries/ioc_data.py
django_countries/models.py
+django_countries/widgets.py
django_countries.egg-info/PKG-INFO
django_countries.egg-info/SOURCES.txt
django_countries.egg-info/dependency_links.txt
django_countries.egg-info/not-zip-safe
django_countries.egg-info/top_level.txt
+django_countries/locale/ar/LC_MESSAGES/django.mo
+django_countries/locale/ar/LC_MESSAGES/django.po
django_countries/locale/cs/LC_MESSAGES/django.mo
django_countries/locale/cs/LC_MESSAGES/django.po
django_countries/locale/de/LC_MESSAGES/django.mo
@@ -22,8 +26,12 @@ django_countries/locale/el/LC_MESSAGES/django.mo
django_countries/locale/el/LC_MESSAGES/django.po
django_countries/locale/en/LC_MESSAGES/django.mo
django_countries/locale/en/LC_MESSAGES/django.po
+django_countries/locale/eo/LC_MESSAGES/django.mo
+django_countries/locale/eo/LC_MESSAGES/django.po
django_countries/locale/es/LC_MESSAGES/django.mo
django_countries/locale/es/LC_MESSAGES/django.po
+django_countries/locale/fa/LC_MESSAGES/django.mo
+django_countries/locale/fa/LC_MESSAGES/django.po
django_countries/locale/fi/LC_MESSAGES/django.mo
django_countries/locale/fi/LC_MESSAGES/django.po
django_countries/locale/fr/LC_MESSAGES/django.mo
@@ -48,7 +56,11 @@ django_countries/locale/ru/LC_MESSAGES/django.mo
django_countries/locale/ru/LC_MESSAGES/django.po
django_countries/locale/sk/LC_MESSAGES/django.mo
django_countries/locale/sk/LC_MESSAGES/django.po
-django_countries/static/flags/.DS_Store
+django_countries/locale/tr_TR/LC_MESSAGES/django.mo
+django_countries/locale/tr_TR/LC_MESSAGES/django.po
+django_countries/locale/uk/LC_MESSAGES/django.mo
+django_countries/locale/uk/LC_MESSAGES/django.po
+django_countries/static/flags/__.gif
django_countries/static/flags/ad.gif
django_countries/static/flags/ae.gif
django_countries/static/flags/af.gif
@@ -118,6 +130,7 @@ django_countries/static/flags/eh.gif
django_countries/static/flags/er.gif
django_countries/static/flags/es.gif
django_countries/static/flags/et.gif
+django_countries/static/flags/eu.gif
django_countries/static/flags/fi.gif
django_countries/static/flags/fj.gif
django_countries/static/flags/fk.gif
@@ -299,8 +312,12 @@ django_countries/static/flags/za.gif
django_countries/static/flags/zm.gif
django_countries/static/flags/zw.gif
django_countries/tests/__init__.py
+django_countries/tests/custom_countries.py
+django_countries/tests/forms.py
django_countries/tests/models.py
django_countries/tests/settings.py
+django_countries/tests/settings_lts.py
django_countries/tests/test_countries.py
django_countries/tests/test_fields.py
-django_countries/tests/test_settings.py
\ No newline at end of file
+django_countries/tests/test_settings.py
+django_countries/tests/test_widgets.py
\ No newline at end of file
diff --git a/django_countries/__init__.py b/django_countries/__init__.py
index 61adef3..1e36ba7 100644
--- a/django_countries/__init__.py
+++ b/django_countries/__init__.py
@@ -1,6 +1,27 @@
-from operator import itemgetter
+#!/usr/bin/env python
+from __future__ import unicode_literals
+from itertools import islice
from django_countries.conf import settings
... 32399 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-countries.git
More information about the Python-modules-commits
mailing list