Merge branch 'fix/tag_product' into 'develop'

Fix/tag product

See merge request gm/gm-backend!142
This commit is contained in:
d.kuzmenko 2019-11-19 14:30:16 +00:00
commit b6292261e4

View File

@ -56,10 +56,10 @@ class Command(BaseCommand):
def add_type_product_category(self):
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)
if types.exists() and category not in types.tag_categories.all():
types.tag_categories.add(category)
if type and category not in type.tag_categories.all():
type.tag_categories.add(category)
self.stdout.write(self.style.WARNING(f'Add type product category objects.'))