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)
评论列表
文章目录