This package provides utility for saving multiple Django model instances using one SQL query.
pip install django-bulk-saving
Inherit from BulkSavableModel:
from bulk_saving.models import BulkSavableModel
from django.db import models
class Product(BulkSavableModel):
name = models.CharField(max_length=30)
Use as follows:
with Product.bulk_saving():
for idx, product in enumerate(Product.objects.all(), 1):
product.name = 'Product nr %s' % idx
product.save_later()
Products will be saved after exit from context.
The Django Wicked Historian package is licensed under the FreeBSD License.