def on_commit(self, fun, *args, **kwargs):
if args or kwargs:
fun = partial(fun, *args, **kwargs)
if on_commit is not None:
try:
return on_commit(fun)
except TransactionManagementError:
pass # not in transaction management, execute now.
return fun()
评论列表
文章目录