Skip to content

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

Remove duplicated shipping queryset

Jakub Draganek2d93d2f14d24
diff --git a/saleor/shipping/models.py b/saleor/shipping/models.py
index 9176d339a2..c0800a2e6f 100644
--- a/saleor/shipping/models.py
+++ b/saleor/shipping/models.py
@@ -105,30 +105,3 @@ class ShippingMethodCountry(models.Model):
def get_total(self):
return self.price
-
-
-class ShippingCountryQueryset(models.QuerySet):
-
- def unique_for_country_code(self, country_code):
- shipping = self.filter(
- Q(country_code=country_code) |
- Q(country_code=ANY_COUNTRY))
- shipping = shipping.order_by('shipping_method_id')
- shipping = shipping.values_list(
- 'shipping_method_id', 'id', 'country_code')
- grouped_shipping = groupby(shipping, itemgetter(0))
- any_country = ANY_COUNTRY
-
- ids = []
-
- for dummy_method_id, method_values in grouped_shipping:
- method_values = list(method_values)
- # if there is any country choice and specific one remove any
- # country choice
- if len(method_values) == 2:
- method = [val for val in method_values
- if val[2] != any_country][0]
- else:
- method = method_values[0]
- ids.append(method[1])
- return self.filter(id__in=ids)