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.
16 lines
402 B
16 lines
402 B
3 years ago
|
from django.dispatch import receiver
|
||
2 years ago
|
from django.db.models.signals import pre_save
|
||
3 years ago
|
|
||
|
from common.utils import get_logger
|
||
2 years ago
|
from ..models import Account
|
||
3 years ago
|
|
||
|
logger = get_logger(__name__)
|
||
|
|
||
|
|
||
2 years ago
|
@receiver(pre_save, sender=Account)
|
||
|
def on_account_pre_create(sender, instance, **kwargs):
|
||
3 years ago
|
# 升级版本号
|
||
3 years ago
|
instance.version += 1
|
||
3 years ago
|
# 即使在 root 组织也不怕
|
||
|
instance.org_id = instance.asset.org_id
|