This commit is contained in:
Виктор Гладких 2019-11-19 16:39:04 +03:00
parent fb0157042a
commit 68baebcbcc

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.'))