Browse Source

fix: 授权资产列表 platform 应该显示名称

pull/5919/head
xinwen 4 years ago committed by 老广
parent
commit
b4ef7bef55
  1. 1
      apps/authentication/urls/api_urls.py
  2. 6
      apps/perms/serializers/asset/user_permission.py

1
apps/authentication/urls/api_urls.py

@ -23,4 +23,3 @@ urlpatterns = [
]
urlpatterns += router.urls

6
apps/perms/serializers/asset/user_permission.py

@ -4,7 +4,7 @@
from rest_framework import serializers
from django.utils.translation import ugettext_lazy as _
from assets.models import Node, SystemUser, Asset
from assets.models import Node, SystemUser, Asset, Platform
from assets.serializers import ProtocolsField
from perms.serializers.asset.permission import ActionsField
@ -39,7 +39,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
被授权资产的数据结构
"""
protocols = ProtocolsField(label=_('Protocols'), required=False, read_only=True)
platform = serializers.ReadOnlyField(source='platform_base')
platform = serializers.SlugRelatedField(
slug_field='name', queryset=Platform.objects.all(), label=_("Platform")
)
class Meta:
model = Asset

Loading…
Cancel
Save