diff --git a/apps/collection/management/commands/import_collection.py b/apps/collection/management/commands/import_collection.py index 23fab48b..0e8fa8d3 100644 --- a/apps/collection/management/commands/import_collection.py +++ b/apps/collection/management/commands/import_collection.py @@ -22,7 +22,7 @@ class Command(BaseCommand): -- a.attachment_file_name, -- a.attachment_content_type, -- a.attachment_file_size, - -- a.attachment_suffix_url, + a.attachment_suffix_url, -- active as is_publish, a.country_code, -- a.geometries, @@ -80,7 +80,7 @@ class Command(BaseCommand): -- a.attachment_file_name, -- a.attachment_content_type, -- a.attachment_file_size, - -- a.attachment_suffix_url, + a.attachment_suffix_url, -- active as is_publish, a.country_code, a.description @@ -97,7 +97,8 @@ class Command(BaseCommand): country=country, description=obj['description'], slug=obj['slug'], old_id=obj['collection_id'], - start=obj['start'] + start=obj['start'], + image_url=obj['attachment_suffix_url'] ) ) Collection.objects.bulk_create(objects) @@ -159,6 +160,8 @@ class Command(BaseCommand): if est.exists(): inst = est.first() collect = Collection.objects.filter(old_id=obj['collection_id']) - for c in collect: - inst.collections.add(c) + print(f'COLLECT COUNT {collect.count()}') + inst.collections.add(*list(collect)) + # for c in collect: + # inst.collections.add(c) inst.save()