Fix publish collect

This commit is contained in:
Виктор Гладких 2019-11-01 16:18:33 +03:00
parent e9b0d0f91b
commit c51cfc1aa4

View File

@ -108,7 +108,8 @@ class Command(BaseCommand):
distinct distinct
a.id, a.id,
a.collection_id, a.collection_id,
a.establishment_id a.establishment_id,
a.active
from from
( (
select distinct select distinct
@ -160,6 +161,7 @@ class Command(BaseCommand):
if est.exists(): if est.exists():
inst = est.first() inst = est.first()
collect = Collection.objects.filter(old_id=obj['collection_id']) collect = Collection.objects.filter(old_id=obj['collection_id'])
collect.update(is_publish=obj['active'])
print(f'COLLECT COUNT {collect.count()}') print(f'COLLECT COUNT {collect.count()}')
inst.collections.add(*list(collect)) inst.collections.add(*list(collect))
# for c in collect: # for c in collect: