diff --git a/backend/data_import/views.py b/backend/data_import/views.py index c9643fc3..280261db 100644 --- a/backend/data_import/views.py +++ b/backend/data_import/views.py @@ -1,6 +1,3 @@ -import os -from pathlib import Path - from django.shortcuts import get_object_or_404 from django_drf_filepond.models import TemporaryUpload from rest_framework import status @@ -32,15 +29,7 @@ class DatasetImportAPI(APIView): upload_ids = request.data.pop("uploadIds") file_format = request.data.pop("format") - # Rename file temporary_uploads = TemporaryUpload.objects.filter(upload_id__in=upload_ids) - for tu in temporary_uploads: - p = Path(tu.get_file_path()) - new_path = Path(p.parent, tu.upload_name) - p.rename(new_path) - tu.file.name = os.path.join(new_path.parent.stem, new_path.name) - TemporaryUpload.objects.bulk_update(temporary_uploads, fields=["file"]) - file_paths = [tu.get_file_path() for tu in temporary_uploads] save_names = {tu.get_file_path(): tu.file.name for tu in temporary_uploads}