Skip to content

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

Bulk add products instead of for loop

akjanik52d96881b3f3
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.py
index 6feebd7168..abdb23e3a1 100644
--- a/saleor/core/utils/random_data.py
+++ b/saleor/core/utils/random_data.py
@@ -542,8 +542,8 @@ def add_address_to_admin(email):
def create_fake_collection():
collection = get_or_create_collection(name='%s collection' % fake.word())
- for product in Product.objects.all().order_by('?')[:4]:
- collection.products.add(product)
+ products = Product.objects.order_by('?')[:4]
+ collection.products.add(*products)
return collection