错误GetFeedbackArea类中的异常:必须先呈现响应内容,然后才能对其进行迭代

时间:2019-02-10 15:35:33

标签: python django django-rest-framework

当我点击该API时,它向我显示错误,必须先渲染响应内容,然后才能对其进行迭代。

  class GetFeedbackArea(APIView):
        parser_classes = [ReadJSONParser]
        authentication_classes = [OAuth2Authentication]
        permission_classes = [IsAuthenticated]

        def post(self, request, format=None):
            """
            Creation of feedback with respect to jobcard_id
            :param request:
            :return:
            """
            try:
                logger.info("GetFeedbackArea")
                data, stat = get_feedback_area(request)
                new_data = generic_feedback_area_translator(data)
                return Response({"data":new_data},status=status.HTTP_200_OK)
            except Exception as ex:
                logger.exception("Exception in class GetFeedbackArea:" + str(ex))
                excp_logger.exception("Exception in class GetFeedbackArea:" + str(ex))
                return Response(sa_error_conf.SOMETHING_WENT_WRONG,
                                status=status.HTTP_412_PRECONDITION_FAILED)

0 个答案:

没有答案