perf: 统一用户名称的label显示

This commit is contained in:
fangfang.dong
2023-07-31 18:06:23 +08:00
committed by Bryan
parent f9c9c9d525
commit b93b64255b
2 changed files with 9 additions and 12 deletions

View File

@@ -27,14 +27,7 @@ class RoleBindingViewSet(OrgBulkModelViewSet):
def get_queryset(self):
queryset = self._get_queryset() \
.prefetch_related('user', 'role', 'org') \
.annotate(
user_display=Concat(
F('user__name'), Value('('),
F('user__username'), Value(')')
),
role_display=F('role__name')
)
.prefetch_related('user', 'role', 'org')
return queryset
def _get_queryset(self):