fix establishment mark

This commit is contained in:
alex 2019-10-31 17:19:07 +03:00
parent 30a58473c3
commit 55e68ec336

View File

@ -1,5 +1,3 @@
from pprint import pprint
from django.core.management.base import BaseCommand
from django.db.models import Q
@ -19,8 +17,6 @@ class Command(BaseCommand):
Q(mark__isnull=True)
).filter(aasm_state='published').values_list('establishment_id', 'mark', 'updated_at')
print(queryset.count())
for es_id, new_mark, new_date in queryset:
try:
mark, date = valid_data[es_id]
@ -41,6 +37,5 @@ class Command(BaseCommand):
establishment.public_mark = int(value[0])
establishment.save()
count += 1
break
self.stdout.write(self.style.WARNING(f'Updated {count} objects.'))