perf: 修改 CommandGroupSerializer type 字段为 LabeledChoiceField

pull/9154/head
Bai 2022-12-04 20:51:22 +08:00
parent 70fb00c4ee
commit 519e0eac01
1 changed files with 2 additions and 3 deletions

View File

@ -1,8 +1,7 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from acls.models import CommandGroup, CommandFilterACL from acls.models import CommandGroup, CommandFilterACL
from common.drf.fields import ObjectRelatedField from common.drf.fields import ObjectRelatedField, LabeledChoiceField
from orgs.mixins.serializers import BulkOrgResourceModelSerializer from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from .base import BaseUserAssetAccountACLSerializerMixin as BaseSerializer from .base import BaseUserAssetAccountACLSerializerMixin as BaseSerializer
@ -10,7 +9,7 @@ __all__ = ["CommandFilterACLSerializer", "CommandGroupSerializer"]
class CommandGroupSerializer(BulkOrgResourceModelSerializer): class CommandGroupSerializer(BulkOrgResourceModelSerializer):
type = serializers.ChoiceField( type = LabeledChoiceField(
choices=CommandGroup.TypeChoices.choices, default=CommandGroup.TypeChoices.command, choices=CommandGroup.TypeChoices.choices, default=CommandGroup.TypeChoices.command,
label=_('Type') label=_('Type')
) )