Always randomize supplier articles
This commit is contained in:
parent
95c59de4fc
commit
56b5fd6279
1 changed files with 1 additions and 3 deletions
|
@ -132,9 +132,7 @@ class Command(MyBaseCommand):
|
||||||
|
|
||||||
supplier, created = Supplier.objects.get_or_create(name="Panoramix")
|
supplier, created = Supplier.objects.get_or_create(name="Panoramix")
|
||||||
if created:
|
if created:
|
||||||
articles = Article.objects.filter(category__name="Autres Bieres")
|
articles = random.sample(list(Article.objects.all()), 40)
|
||||||
if not articles.exists():
|
|
||||||
articles = random.sample(Article.objects.all(), 30)
|
|
||||||
to_create = []
|
to_create = []
|
||||||
for article in articles:
|
for article in articles:
|
||||||
to_create.append(SupplierArticle(
|
to_create.append(SupplierArticle(
|
||||||
|
|
Loading…
Reference in a new issue