Merge pull request #3209 from jumpserver/dev_initnodes

[Bugfix] 修改初始化一些节点时,assets_node表不存在的问题
pull/3211/head
BaiJiangJie 5 years ago committed by GitHub
commit 4f7c668c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save