Commit 5beb5445 authored by Mario Chirinos's avatar Mario Chirinos

bulk upload

parent 9884d8d0
......@@ -9,7 +9,7 @@ from django.utils import timezone
import dateutil.parser
import itertools
from datetime import date
from itertools import islice
updateRadioStations = False
recordingsDir = "/home/geoint/M3_NFS/recordings/"
......@@ -122,14 +122,12 @@ class Command(BaseCommand):
news.topic_raw = json.domps(topicst)
# news.save()
objectsList.append(news)
from itertools import islice
batch_size = 100
while True:
batch = list(islice(objectsList, batch_size))
if not batch:
break
News.objects.bulk_create(batch, batch_size)
batch_size = 100
while True:
batch = list(islice(objectsList, batch_size))
if not batch:
break
News.objects.bulk_create(batch, batch_size)
except ValueError as e:
print (e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment