Generate dummy baskets with no fixed price items

This commit is contained in:
Gabriel Augendre 2023-03-27 18:28:14 +02:00
parent 0f0e4f854a
commit e3bb57396b
2 changed files with 29 additions and 8 deletions

View file

@ -75,5 +75,16 @@
"unit_price_cents": 290, "unit_price_cents": 290,
"display_order": 7 "display_order": 7
} }
},
{
"model": "purchase.product",
"fields": {
"created_at": "2022-04-28T16:08:20.471Z",
"updated_at": "2022-04-28T16:09:34.003Z",
"name": "Tomme de ch\u00e8vre",
"image": "",
"unit_price_cents": 0,
"display_order": 8
}
} }
] ]

View file

@ -52,6 +52,16 @@ class Command(BaseCommand):
) )
items = [] items = []
for product in selected_products: for product in selected_products:
if not product.has_fixed_price:
items.append(
BasketItem(
product=product,
basket=basket,
quantity=1,
unit_price_cents=random.randint(317, 514),
),
)
else:
items.append( items.append(
BasketItem( BasketItem(
product=product, product=product,