django-countries
django-countries copied to clipboard
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.
Let's say I have `country = CountryField(multiple=True)` somewhere in my open source project. We have migration that has `max_length=749`. But then someone adds (before running migration) `COUNTRIES_ONLY=["US"]`. Because of this...
I'm trying to set a blank_label for Country select in my filterset [django-filters](https://django-filter.readthedocs.io/en/stable/) but I'm not able to do this. Are there any workarounds or anythings that would make this...
It seems that if I set `COUNTRIES_FIRST_BREAK`, the widget doesn't render the `required` attribute? with these settings: ``` COUNTRIES_FIRST = ["US", "RU", ] COUNTRIES_FIRST_REPEAT = True COUNTRIES_FIRST_SORT = False COUNTRIES_FIRST_BREAK...
##### In forms.py ``` from django_countries.widgets import CountrySelectWidget from django import forms from enroll.models import Person class PersonForm(forms.ModelForm): class Meta: model = Person fields = ('name', 'country') widgets = {'country':...
I think the `tox.ini` full list of environments is quite out of date, and so isn't even running Django 3.2+ tests on CI? But I wasn't confident there so I...
Fixes #393 .
Fix this warning seen when running the tests on Django 4.0+: ``` $ tox -e py310-django40 ... ===== warnings summary ===== .tox/py310-django40/lib/python3.10/site-packages/django/conf/__init__.py:206 /.../site-packages/django/conf/__init__.py:206: RemovedInDjango50Warning: The default value of USE_TZ will...
The countries should be stored ordered. So low level database lookups can be easier made. As a work-a-round is to use `permutations` e.g.: ```python gas_countries = list(','.join(codes) for codes in...
will fix: https://github.com/SmileyChris/django-countries/issues/387 and https://github.com/SmileyChris/django-countries/issues/395
always strip duplicate countries when saving a CountryField which has multiple=True (resolves #387)