From cc167f1b49f0c76643c266ebce326fffaa8553ac Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 14 Jun 2022 19:49:07 +0800 Subject: [PATCH] xxx --- apps/assets/migrations/0099_auto_20220426_1558.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/assets/migrations/0099_auto_20220426_1558.py b/apps/assets/migrations/0099_auto_20220426_1558.py index 69ee76277..a42837899 100644 --- a/apps/assets/migrations/0099_auto_20220426_1558.py +++ b/apps/assets/migrations/0099_auto_20220426_1558.py @@ -182,14 +182,15 @@ def migrate_to_nodes(apps, *args): category__in=['remote_app', 'database', 'cloud'], org_id=org.id ) + if not node: + continue print("Set node asset: ", node) - if node: - node.assets_amount = len(assets) - node.save() - node.assets.set(assets) - parent = node.parent - parent.assets_amount += len(assets) - parent.save() + node.assets_amount = len(assets) + node.save() + node.assets.set(assets) + parent = node.parent + parent.assets_amount += len(assets) + parent.save() class Migration(migrations.Migration):