def create(request): result = True try: print(request.POST) ProjectService.create_project(request) except Exception as ex: result = "项目创建失败失败,请联系管理员" SimpleLogger.error(ex) return HttpResponse(result)
def create(self, request, *args, **kwargs): project = ProjectService.create_project(request) serializer = project_serializer.ProjectSerializer(instance=project,data = request.data) serializer.is_valid(raise_exception=True) # self.perform_create(serializer) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)