You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the geonode.layers.forms.LayerUploadForm forces us to recognize the files from the request.FILES only.
We need to generalize this and allow the form to be able to eventually fetch the files from a local path too, avoiding to store them again on the local storage.
EDIT: Envisage using the StorageManager in order to save the uploaded files.
e.g.:
In Django we can do something like this:
If you want to do this permanently, you need to create your own FileStorage class
importosfromdjango.confimportsettingsfromdjango.core.files.storageimportFileSystemStorageclassMyFileStorage(FileSystemStorage):
# This method is actually defined in Storagedefget_available_name(self, name):
ifself.exists(name):
os.remove(os.path.join(settings.MEDIA_ROOT, name))
returnname# simply returns the name passed
Now in your model, you use your modified MyFileStorage
Currently the
geonode.layers.forms.LayerUploadForm
forces us to recognize the files from therequest.FILES
only.We need to generalize this and allow the form to be able to eventually fetch the files from a local path too, avoiding to store them again on the local storage.
EDIT: Envisage using the
StorageManager
in order to save the uploaded files.e.g.:
In Django we can do something like this:
If you want to do this permanently, you need to create your own
FileStorage
classNow in your model, you use your modified
MyFileStorage
The text was updated successfully, but these errors were encountered: