diff --git a/apps/authentication/urls/api_urls.py b/apps/authentication/urls/api_urls.py index 40eb2912e..d9b302800 100644 --- a/apps/authentication/urls/api_urls.py +++ b/apps/authentication/urls/api_urls.py @@ -23,4 +23,3 @@ urlpatterns = [ ] urlpatterns += router.urls - diff --git a/apps/perms/serializers/asset/user_permission.py b/apps/perms/serializers/asset/user_permission.py index be33d679b..f844b7d4d 100644 --- a/apps/perms/serializers/asset/user_permission.py +++ b/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