If you just want to have a country ChoiceField without installing django-choices you can create an extra file which holds a tuple with all choices from the Wikipedia Iso Country Codes:
import csv
# Get the file from: "http://geohack.net/gis/wikipedia-iso-country-codes.csv"
with open("wikipedia-iso-country-codes.csv") as f:
file = csv.DictReader(f, delimiter=',')
country_names = [line['English short name lower case'] for line in file]
# Create a tuple with the country names
with open("country_names.py", 'w') as f:
f.write('COUNTRY_CHOICES = (\n')
for c in country_names:
f.write(f' ("{c}", "{c}"),\n')
f.write(')')
The created country_names.py file looks something like this:
COUNTRY_CHOICES = (
("Afghanistan", "Afghanistan"),
("Åland Islands", "Åland Islands"),
("Albania", "Albania"),
("Algeria", "Algeria"),
("American Samoa", "American Samoa"),
...
)
You can then use COUNTRY_CHOICES in your form like this:
from django import forms
from country_names import COUNTRY_CHOICES
class CountryForm(forms.Form):
country= forms.ChoiceField(choices=COUNTRY_CHOICES)