[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

15
apps/perms/api/base.py Normal file
View File

@@ -0,0 +1,15 @@
from django.db.models import F
from orgs.mixins.api import OrgBulkModelViewSet
from orgs.mixins.api import OrgRelationMixin
__all__ = [
'RelationViewSet'
]
class RelationViewSet(OrgRelationMixin, OrgBulkModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.annotate(**{f'{self.from_field}_display': F(f'{self.from_field}__name')})
return queryset