mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
297 B
13 lines
297 B
6 years ago
|
# -*- coding: utf-8 -*-
|
||
|
#
|
||
|
from django.db import transaction
|
||
|
|
||
|
|
||
|
def on_transaction_commit(func):
|
||
|
"""
|
||
|
如果不调用on_commit, 对象创建时添加多对多字段值失败
|
||
|
"""
|
||
|
def inner(*args, **kwargs):
|
||
|
transaction.on_commit(lambda: func(*args, **kwargs))
|
||
|
return inner
|