21 lines
545 B
Python
21 lines
545 B
Python
from rest_framework import serializers
|
|
from .models import Dictionary
|
|
|
|
|
|
class DictionarySerializer(serializers.ModelSerializer):
|
|
"""
|
|
数据字典序列化器
|
|
"""
|
|
class Meta:
|
|
model = Dictionary
|
|
fields = ['id', 'type', 'name', 'value', 'created_at', 'updated_at']
|
|
read_only_fields = ['id', 'created_at', 'updated_at']
|
|
|
|
|
|
class DictionaryGroupSerializer(serializers.Serializer):
|
|
"""
|
|
数据字典分组序列化器
|
|
"""
|
|
type = serializers.CharField()
|
|
items = DictionarySerializer(many=True)
|