I have this code
Task.objects.bulk_create(ces)
Now this is my signal
@receiver(pre_save, sender=Task)
def save_hours(sender, instance, *args, **kwargs):
logger.debug('test')
Now this signal is not triggered in bulk create
I am using django 1.8
As mentioned
bulk_create
does not trigger these signals -https://docs.djangoproject.com/en/1.8/ref/models/querysets/#bulk-create
So you have to trigger them manually. If you want this for all models you can override the
bulk_create
and send them yourself like this -Then use this manager -
Iterating on the answer above:
Python 2:
Python 3:
Complete answer in python 2: