mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修改初始化一些节点时,assets_node表不存在的问题
parent
c0afeba215
commit
9f2e49c9e9
|
@ -1,6 +1,16 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
from django.db.models.signals import post_migrate
|
||||||
|
|
||||||
|
|
||||||
|
def initial_some_nodes():
|
||||||
|
from .models import Node
|
||||||
|
Node.initial_some_nodes()
|
||||||
|
|
||||||
|
|
||||||
|
def initial_some_nodes_callback(sender, **kwargs):
|
||||||
|
initial_some_nodes()
|
||||||
|
|
||||||
|
|
||||||
class AssetsConfig(AppConfig):
|
class AssetsConfig(AppConfig):
|
||||||
|
@ -9,5 +19,7 @@ class AssetsConfig(AppConfig):
|
||||||
def ready(self):
|
def ready(self):
|
||||||
super().ready()
|
super().ready()
|
||||||
from . import signals_handler
|
from . import signals_handler
|
||||||
from .models import Node
|
try:
|
||||||
Node.initial_some_nodes()
|
initial_some_nodes()
|
||||||
|
except Exception:
|
||||||
|
post_migrate.connect(initial_some_nodes_callback, sender=self)
|
||||||
|
|
Loading…
Reference in New Issue