From 68baebcbcc4f91bd9b5e25ef495b9f05d9a75d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=93=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=D1=85?= Date: Tue, 19 Nov 2019 16:39:04 +0300 Subject: [PATCH] Fix fix --- apps/product/management/commands/add_product_tag.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/product/management/commands/add_product_tag.py b/apps/product/management/commands/add_product_tag.py index 33c98b6b..589c7a83 100644 --- a/apps/product/management/commands/add_product_tag.py +++ b/apps/product/management/commands/add_product_tag.py @@ -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.'))