Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Sort country choices

Mira Szewczyk7ad890307ba5
diff --git a/saleor/cart/forms.py b/saleor/cart/forms.py
index 3b6c115970..8651c7c89f 100644
--- a/saleor/cart/forms.py
+++ b/saleor/cart/forms.py
@@ -119,7 +119,7 @@ class ReplaceCartLineForm(AddToCartForm):
class CountryForm(forms.Form):
country = forms.ChoiceField(
- choices=sorted(COUNTRY_CODE_CHOICES, key=lambda t: t[1]), label='')
+ choices=COUNTRY_CODE_CHOICES, label='')
def get_shipment_options(self):
code = self.cleaned_data['country']
diff --git a/saleor/shipping/models.py b/saleor/shipping/models.py
index 6ec691a37b..d17e5b2ced 100644
--- a/saleor/shipping/models.py
+++ b/saleor/shipping/models.py
@@ -14,8 +14,7 @@ from django_countries import countries
ANY_COUNTRY = ''
ANY_COUNTRY_DISPLAY = _('Rest of World')
-COUNTRY_CODE_CHOICES = [(ANY_COUNTRY, ANY_COUNTRY_DISPLAY)] + list(
- dict(countries).items())
+COUNTRY_CODE_CHOICES = [(ANY_COUNTRY, ANY_COUNTRY_DISPLAY)] + list(countries)
@python_2_unicode_compatible