mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 09:21:02 +00:00
[Feature] 权限管理-> 远程应用 添加 api (#4040)
* [Feature] 权限管理-> 远程应用 添加 api * [Feature] 添加 RelationMixin
This commit is contained in:
15
apps/perms/api/base.py
Normal file
15
apps/perms/api/base.py
Normal 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
|
Reference in New Issue
Block a user