Skip to content

Commit

Permalink
Fix upload_to path
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Mar 14, 2024
1 parent 2633282 commit 1ff9290
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions readux_ingest_ecds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -62,6 +62,7 @@ class Local(IngestAbstractModel):
bundle = models.FileField(
null=True,
blank=True,
storage=TmpStorage,
upload_to=local_tmp
)

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1ff9290

Please sign in to comment.