📜  github hacksofteare - Shell-Bash 代码示例

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

代码示例3
class CourseDetailApi(SomeAuthenticationMixin, APIView):
    class OutputSerializer(serializers.ModelSerializer):
        class Meta:
            model = Course
            fields = ('id', 'name', 'start_date', 'end_date')

    def get(self, request, course_id):
        course = get_course(id=course_id)

        serializer = self.OutputSerializer(course)

        return Response(serializer.data)