I have an app in which I want to show the replica of the google drive folder structure in my app. I can get data from google drive via its API. But I do struggle in uploading that data to the FileManager library of DevExtreme. Also how to send the data obtained from backend via an AJAX request (POST|GET).
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LoadCredentialsFile("mycreds.txt")
if gauth.credentials is None:
# Authenticate if they're not there
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
# Refresh them if expired
gauth.Refresh()
else:
# Initialize the saved creds
gauth.Authorize()
# Save the current credentials to a file
gauth.SaveCredentialsFile("mycreds.txt")
img = drive.CreateFile({'id': file_id})
img.GetContentFile('sample.jpg')
data = [
{
name: "MyFile.jpg",
size: 1024,
dateModified: "2019/05/08",
thumbnail: "/thumbnails/images/jpeg.ico",
isDirectory: true,
items: [
// ...
// Nested data objects with the same structure
// ...
]
}
]
new DevExpress.ui.dxFileManager(document.getElementById("file-manager"), {
"fileSystemProvider": data,
"itemView": {
"mode": "thumbnails"
},
"permissions": {
"copy": true,
"create": true,
"delete": true,
"download": true,
"move": true,
"rename": true,
"upload": true
},
"rootFolderName": "PayUP",
"rtlEnabled": false,
"currentPath": path,
onSelectionChanged: function (e) {
console.log(e)
}
});
The thing I want is how to add the downloaded image in data above from Django backend via ajax to client side.
This is the DevExtreme File Manager