📜  django 中的序列化 - Python 代码示例

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

代码示例1
serialization in django

from rest_framework import serializers
from .models import Product

class ProductSerializers(serializers.ModelSerializer):
    class Meta:
        model = Product
        fields = '__all__'
        
# Serializers allow complex data such as querysets and model instances to be converted to native Python datatypes that can then be easily rendered into JSON, XML or other content types. 
# Serializers also provide deserialization, allowing parsed data to be converted back into complex types, after first validating the incoming data.