2022-09-20 09:33:15 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
|
|
|
|
|
|
class TypeSerializer(serializers.Serializer):
|
2022-09-21 12:13:28 +00:00
|
|
|
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'))
|
2022-09-20 09:33:15 +00:00
|
|
|
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):
|
2022-09-21 12:13:28 +00:00
|
|
|
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)
|