from rest_framework import serializers from .models import Student # 你需要根据你的模型导入相应的类 class StudentSerializer(serializers.ModelSerializer): class Meta: model = Student fields = ['name', 'student_id', 'score', 'attendance_count', 'called_count'] # 根据你的模型字段进行调整