modelserializser专题

APIView视图的序列化器继承ModelSerializser

一、在serializser.py编写序列化器继承于ModelSerializser from .models import Publishclass PublishSerializer(serializers.ModelSerializer):class Meta:model = Publishfields = "__all__" 二、在views.py编写类视图继承于APIView f