From 705bac4b81f6b710f52a94b2471aca32a690ccb6 Mon Sep 17 00:00:00 2001 From: Jay Varner Date: Fri, 19 Jul 2024 16:42:24 -0400 Subject: [PATCH] Another potential fix --- readux_ingest_ecds/admin.py | 3 ++- test_app/tests/test_bulk_admin.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/readux_ingest_ecds/admin.py b/readux_ingest_ecds/admin.py index 1a0f8f5..24d491d 100644 --- a/readux_ingest_ecds/admin.py +++ b/readux_ingest_ecds/admin.py @@ -51,9 +51,10 @@ def save_model(self, request, obj, form, change): form.save_m2m() obj.save() - ingest_files = request.FILES.getlist("volume_files") + ingest_files = request.FILES.getlist("volume_files")[0] for ingest_file in ingest_files: + print(ingest_file) if ( "metadata" in ingest_file.name.casefold() and "zip" not in guess_type(ingest_file.name)[0] diff --git a/test_app/tests/test_bulk_admin.py b/test_app/tests/test_bulk_admin.py index c8bde60..9221c96 100644 --- a/test_app/tests/test_bulk_admin.py +++ b/test_app/tests/test_bulk_admin.py @@ -102,10 +102,10 @@ def test_bulk_admin_save_multiple(self): with open(bundle_file_two_path, "rb") as f: bundle_file_two_content = files.base.ContentFile(f.read()) bundle_file_two = files.File(bundle_file_two_content.file, "volume3.zip") - data["volume_files"] = [metadata_file, bundle_file_one, bundle_file_two] request_factory = RequestFactory() req = request_factory.post("/admin/ingest/bulk/add/", data=data) + req.FILES["volume_files"] = [metadata_file, bundle_file_one, bundle_file_two] req.user = self.user bulk_model_admin = BulkAdmin(model=Bulk, admin_site=AdminSite())