From 0c0eb843abf350c0da855c30488a0af30cf7cdb9 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 13 Jan 2020 12:50:01 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E6=A0=91=E7=A7=BB=E5=8A=A8=E8=B5=84=E4=BA=A7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/signals_handler.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/assets/signals_handler.py b/apps/assets/signals_handler.py index 3b23de31b..4f171d36f 100644 --- a/apps/assets/signals_handler.py +++ b/apps/assets/signals_handler.py @@ -132,13 +132,12 @@ def on_asset_nodes_add(sender, instance=None, action='', model=None, pk_set=None if action != "post_add": return logger.debug("Assets node add signal recv: {}".format(action)) - queryset = model.objects.filter(pk__in=pk_set).values_list('key', flat=True) if model == Node: - nodes = queryset - assets = [instance] + nodes = model.objects.filter(pk__in=pk_set).values_list('key', flat=True) + assets = [instance.id] else: - nodes = [instance] - assets = queryset + nodes = [instance.key] + assets = model.objects.filter(pk__in=pk_set).values_list('id', flat=True) # 节点资产发生变化时,将资产关联到节点及祖先节点关联的系统用户, 只关注新增的 nodes_ancestors_keys = set() node_tree = TreeService.new()