Ejemplo n.º 1
0
 def get(self, request, pk, *args, **kwargs):
     ret = BaseResponse()
     try:
         # d 查看id=1的学位课对应的所有模块名称
         queryset = models.DegreeCourse.objects.filter(id=pk)
         ser = degree.DegreeCourseSerializer(instance=queryset, many=True)
         ret.data = ser.data
     except Exception as e:
         ret.code = 0
         ret.errors = "数据获取失败"
     return Response(ret.dict)
Ejemplo n.º 2
0
    def get(self, request, pk, *args, **kwargs):
        ret = BaseResponse()

        try:
            queryset = models.Course.objects.filter(id=pk,
                                                    degree_course__isnull=True)
            ser = course.CourseSerializer(instance=queryset, many=True)
            ret.data = ser.data
        except Exception as e:
            ret.code = 0
            ret.errors = "数据获取失败"
        return Response(ret.dict)
Ejemplo n.º 3
0
 def get(self, request, *args, **kwargs):
     ret = BaseResponse()
     try:
         # a.查看所有学位课并打印学位课名称以及授课老师
         queryset = models.DegreeCourse.objects.all()
         # b.查看所有学位课并打印学位课名称以及学位课的奖学金
         # 见序列化类
         ser = degree.DegreeCourseSerializer(instance=queryset, many=True)
         ret.data = ser.data
     except Exception as e:
         ret.code = 0
         ret.errors = "数据获取失败"
     return Response(ret.dict)