You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/assets/serializers/cagegory.py

16 lines
890 B

from rest_framework import serializers
from django.utils.translation import gettext_lazy as _
class TypeSerializer(serializers.Serializer):
label = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Label'))
value = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Value'))
category = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Category'))
constraints = serializers.JSONField(required=False, allow_null=True, label=_('Constraints'))
class CategorySerializer(serializers.Serializer):
label = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Label'))
value = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Value'))
types = TypeSerializer(many=True, required=False, label=_('Types'), read_only=True)