class StudentViewSet(viewsets.ModelViewSet):
'''
-查看结洼,編輯用戶數(shù)據(jù)的api接口
'''
queryset= Student.objects.all() # 要序列化的數(shù)據(jù)
serializer_class= StudentSerializer # 要是哪個(gè)序列化類
這段代碼實(shí)現(xiàn)了列表創(chuàng)建,更新叉跛,獲取詳情松忍,刪除這些操作
-詳情頁(yè)實(shí)在serializer.py里面實(shí)現(xiàn)
'''python
class StudentSerializer(HyperlinkedModelSerializer):
class Meta:
model = Student #序列化哪個(gè)模型
fields = ('id','name','age','group')
'''