This commit is contained in:
Виктор Гладких 2019-11-01 15:19:42 +03:00
parent 1df89b6c48
commit 5e65bff2ba

View File

@ -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()