0

我正在运行批量保存过程,但是我的 post_save 函数似乎并未针对每个对象运行?任何人都可以阻止任何问题吗?

保存功能

 objs = [
        Message(
            recipient_number=e.mobile,
            content=content,
            sender=e.contact_owner,
            billee=user,
            sender_name=sender,
            gateway=gateway,
        )
        for e in query

    ]
    # Send messages to DB
    Message.objects.bulk_create(objs)

模型.py

@receiver(post_save, sender=Message)
def my_post_save_handler(sender, instance, **kwargs):
    """
    Post Save Signal.
    Sent at the end of the save() method. Attached to 'Message'.
    """
    print("=========================================")
    print(instance.gateway)
    instance.send(instance.gateway)

post_save.connect(my_post_save_handler, sender=Message)
4

1 回答 1

2

post_save没有被解雇,除其他外,bulk_createupdate

于 2013-08-24T18:02:46.963 回答