mirror of https://github.com/jumpserver/jumpserver
perf: 修改 CommandGroupSerializer type 字段为 LabeledChoiceField
parent
70fb00c4ee
commit
519e0eac01
|
@ -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')
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue