📅  最后修改于: 2022-03-11 14:45:26.583000             🧑  作者: Mango
class CourseListApi(SomeAuthenticationMixin, APIView):
class OutputSerializer(serializers.ModelSerializer):
class Meta:
model = Course
fields = ('id', 'name', 'start_date', 'end_date')
def get(self, request):
courses = get_courses()
serializer = self.OutputSerializer(courses, many=True)
return Response(serializer.data)