From 017710c0569add7da03a9507331cb194ca6418d2 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Fri, 11 Mar 2022 21:24:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9perms=20(#7822)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: 修改 perm tree * perf: 修改perms Co-authored-by: ibuler --- apps/rbac/tree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index a5d0cde1a..68fb3fddc 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -305,7 +305,7 @@ class PermissionTreeUtil: # name 要特殊处理,解决 i18n 问题 name = self._get_permission_name(p, content_types_name_mapper) if settings.DEBUG: - name += '({})'.format(p.app_label_codename) + name += '[{}]'.format(p.app_label_codename) title = p.app_label_codename pid = model_id @@ -353,9 +353,10 @@ class PermissionTreeUtil: }, **data } - if not node_data.get('title'): - node_data['title'] = node_data['name'] + node_data['title'] = node_data['id'] node = TreeNode(**node_data) + if settings.DEBUG: + node.name += ('[' + node.id + ']') if settings.DEBUG: node.name += ('-' + node.id) node.name += f'({checked_count}/{total_count})'