fix: creacion repetida de categoria de productos.
This commit is contained in:
@@ -65,9 +65,11 @@ def handle_import_products_file(csv_file):
|
||||
product.measuring_unit = row['unidad']
|
||||
product.save()
|
||||
|
||||
categories = [n.strip for n in row["categorias"].split("&")]
|
||||
categories = [n.strip() for n in row["categorias"].split("&")]
|
||||
for category in categories:
|
||||
category_model, _ = ProductCategory.objects.get_or_create(
|
||||
name=category
|
||||
)
|
||||
category_model.save()
|
||||
product.categories.add(category_model)
|
||||
product.save()
|
||||
|
||||
Reference in New Issue
Block a user