[Feature] 权限管理-> 远程应用 添加 api (#4040)

* [Feature] 权限管理-> 远程应用 添加 api

* [Feature] 添加 RelationMixin
This commit is contained in:
xinwen
2020-05-28 17:00:42 +08:00
committed by GitHub
parent 3e5d949610
commit 7dde15cb04
19 changed files with 291 additions and 45 deletions

View File

@@ -36,8 +36,8 @@ class RemoteAppPermissionSerializer(BulkOrgResourceModelSerializer):
def setup_eager_loading(cls, queryset):
""" Perform necessary eager loading of data. """
queryset = queryset.annotate(
users_amount=Count('users'), user_groups_amount=Count('user_groups'),
remote_apps_amount=Count('remote_apps'), system_users_amount=Count('system_users')
users_amount=Count('users', distinct=True), user_groups_amount=Count('user_groups', distinct=True),
remote_apps_amount=Count('remote_apps', distinct=True), system_users_amount=Count('system_users', distinct=True)
)
return queryset