📜  序列化嵌套对象 drf,django restframework 嵌套对象序列化 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:27.192000             🧑  作者: Mango

代码示例1
class UserSerializer(serializers.Serializer):
    email = serializers.EmailField()
    username = serializers.CharField(max_length=100)

class CommentSerializer(serializers.Serializer):
    user = UserSerializer()
    content = serializers.CharField(max_length=200)
    created = serializers.DateTimeField()