def single(self, request, **kwargs): """ 得到单个项目相关统计信息 """ pk = kwargs.pop('pk') try: queryset = models.Project.objects.get(id=pk) except ObjectDoesNotExist: return Response(response.PROJECT_NOT_EXISTS) serializer = self.get_serializer(queryset, many=False) project_info = prepare.get_project_detail(pk) project_info.update(serializer.data) return Response(project_info)
def get(self, request, **kwargs): return Response(prepare.get_project_detail(kwargs['pk']))