added image-grabbing code to woocommerve migration,images still saved locally

This commit is contained in:
Sam
2021-02-22 11:21:19 +00:00
parent ee0150e513
commit 5a1084bf7b
3 changed files with 31 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ from django.conf import settings
from django.core.management.base import BaseCommand
from companies.models import Company
from products.models import Product
from utils.woocommerce import migrate_shop_products
@@ -29,6 +30,9 @@ class Command(BaseCommand):
help = 'Load data from example site https://woo.enreda.coop/ '
def handle(self, *args, **kwargs):
print("Deleting existing Product instances")
Product.objects.all().delete()
print("Migrate data from Enreda WooCommerce...\n")
# find or create company instance
enreda, created = Company.objects.get_or_create(company_name='enreda', web_link=self.url)