From 1ff929058eb05d3a0f0b1b570c13330c420be659 Mon Sep 17 00:00:00 2001 From: Jay Varner Date: Thu, 14 Mar 2024 14:41:38 -0400 Subject: [PATCH] Fix upload_to path --- readux_ingest_ecds/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readux_ingest_ecds/models.py b/readux_ingest_ecds/models.py index 8573837..9eecdec 100644 --- a/readux_ingest_ecds/models.py +++ b/readux_ingest_ecds/models.py @@ -25,7 +25,7 @@ def bulk_path(instance, filename): def local_tmp(instance, filename): path = os.path.join(settings.INGEST_TMP_DIR, str(instance.id)) os.makedirs(path, exist_ok=True) - return os.path.join(path, filename) + return os.path.join(str(instance.id), filename) class IngestAbstractModel(models.Model): metadata = models.JSONField(default=dict, blank=True) @@ -62,6 +62,7 @@ class Local(IngestAbstractModel): bundle = models.FileField( null=True, blank=True, + storage=TmpStorage, upload_to=local_tmp ) @@ -225,7 +226,7 @@ class Bulk(models.Model): null=True, related_name='ecds_bulk_ingest_created_locals' ) - volume_files = models.FileField(blank=False, null=True, upload_to=bulk_path) + volume_files = models.FileField(blank=False, null=True, upload_to=bulk_path, storage=TmpStorage) def upload_files(self, files): for uploaded_file in files: