2022-09-20 09:33:15 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2023-10-26 11:19:09 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'TypeSerializer', 'CategorySerializer', 'ProtocolSerializer'
|
|
|
|
]
|
2022-09-20 09:33:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2023-10-26 11:19:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ProtocolSerializer(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'))
|