Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Not hitting the database if no collection is given
George Lubaretsi359212be4451
diff --git a/saleor/product/models/base_products.py b/saleor/product/models/base_products.pyindex fba108da9d..8b4af2a680 100644--- a/saleor/product/models/base_products.py+++ b/saleor/product/models/base_products.py@@ -65,8 +65,10 @@ class Product(Subtyped, ItemRange):return mark_safe(re.sub(r'[-\s]+', '-', value))def get_products_from_collection(self):- return Product.objects.filter(collection=self.collection,- collection__isnull=False).exclude(collection__iexact='')+ return Product.objects.filter(+ collection=self.collection,+ collection__isnull=False+ ).exclude(collection__iexact='') if self.collection else Nonedef __iter__(self):return iter(self.variants.all())