1👍
✅
total = Message.objects.all().count()
for i in xrange(0,total,500):
batch = Message.objects.all()[i:500]
1👍
all_messages = Message.objects.all()
if all_messages.count() == 0:
return
n = all_messages.count() / 500
for i in range (n if n else 1):
messages = all_messages[i*500:(i+1)*500]
bulk_send(messages)
- [Answered ]-Django forms: two form models in one <form> with a foreign key
- [Answered ]-Rendering/Raising A Validation Error on an HTML Template in Django
- [Answered ]-How to save an image from Google Places API to an ImageField in a Django app?
- [Answered ]-Write a Validator Class in Django-rest-framework that has access to the validatated_data
Source:stackexchange.com