jumpserver/apps/perms/api/base.py
xinwen 7dde15cb04
[Feature] 权限管理-> 远程应用 添加 api (#4040)
* [Feature] 权限管理-> 远程应用 添加 api

* [Feature] 添加 RelationMixin
2020-05-28 17:00:42 +08:00

16 lines
422 B
Python

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