Merge branch 'fix/tag_product' into 'develop'
Fix/tag product See merge request gm/gm-backend!142
This commit is contained in:
commit
b6292261e4
|
|
@ -56,10 +56,10 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def add_type_product_category(self):
|
def add_type_product_category(self):
|
||||||
for c in tqdm(self.product_type_category_sql(), desc='Add type product category'):
|
for c in tqdm(self.product_type_category_sql(), desc='Add type product category'):
|
||||||
types = ProductType.objects.filter(index_name='wine')
|
type = ProductType.objects.get(index_name='wine')
|
||||||
category = TagCategory.objects.get(index_name=c.tag_category)
|
category = TagCategory.objects.get(index_name=c.tag_category)
|
||||||
if types.exists() and category not in types.tag_categories.all():
|
if type and category not in type.tag_categories.all():
|
||||||
types.tag_categories.add(category)
|
type.tag_categories.add(category)
|
||||||
|
|
||||||
self.stdout.write(self.style.WARNING(f'Add type product category objects.'))
|
self.stdout.write(self.style.WARNING(f'Add type product category objects.'))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user