models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:django-rest-framework-reactive 作者: genialis 项目源码 文件源码
def model_post_save(sender, instance, created=False, **kwargs):
    """
    Signal emitted after any model is saved via Django ORM.

    :param sender: Model class that was saved
    :param instance: The actual instance that was saved
    :param created: True if a new row was created
    """

    def notify():
        table = sender._meta.db_table
        if created:
            observer_client.notify_table_insert(table)
        else:
            observer_client.notify_table_update(table)

    transaction.on_commit(notify)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号