Skip to content

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

Improve country select form

Artur Smęt035f5c390eed
diff --git a/saleor/cart/forms.py b/saleor/cart/forms.py
index be52ac2b1b..7aedd13cf0 100644
--- a/saleor/cart/forms.py
+++ b/saleor/cart/forms.py
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ObjectDoesNotExist, NON_FIELD_ERRORS
from django.utils.translation import pgettext_lazy, ugettext_lazy
+from django_countries.fields import LazyTypedChoiceField, countries
from satchless.item import InsufficientStock
-from ..shipping.models import COUNTRY_CODE_CHOICES
from ..shipping.utils import get_shipment_options
@@ -118,8 +118,7 @@ class ReplaceCartLineForm(AddToCartForm):
class CountryForm(forms.Form):
- country = forms.ChoiceField(choices=COUNTRY_CODE_CHOICES, label='',
- required=False)
+ country = LazyTypedChoiceField(choices=countries)
def get_shipment_options(self):
code = self.cleaned_data['country']