def _wrapper(view, request, *args, **kwargs): response_data = handler(view, request, *args, **kwargs) if not serializer: return Response(response_data) ser = serializer(data=response_data, many=True) if not ser.is_valid(): raise exceptions.ValidationError(message=str(ser.errors)) return Response(ser.validated_data)
def _wrapper(view, request, *args, **kwargs): ser = serializer(data=request.query_params) if not ser.is_valid(): raise exceptions.ValidationError(message=str(ser.errors)) return handler(view, request, *args, **kwargs)