This commit is contained in:
Виктор Гладких 2019-11-13 12:23:05 +03:00
parent cb127ef879
commit ed1ee3705f

View File

@ -90,8 +90,9 @@ class Command(BaseCommand):
tag.filter(lower_value=t.tag_value, category=category) tag.filter(lower_value=t.tag_value, category=category)
products = Product.objects.filter(old_id=t.product_id) products = Product.objects.filter(old_id=t.product_id)
if products.exists(): if products.exists():
products.tags.add(tag) for p in products.all():
products.save() p.tags.add(tag)
p.save()
self.stdout.write(self.style.WARNING(f'Add or get tag objects.')) self.stdout.write(self.style.WARNING(f'Add or get tag objects.'))