perf: 修改perms (#7822)

* perf: 修改 perm tree

* perf: 修改perms

Co-authored-by: ibuler <ibuler@qq.com>
pull/7824/head
fit2bot 2022-03-11 21:24:07 +08:00 committed by GitHub
parent a876a82a76
commit 017710c056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -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})'