Skip to content

Commit

Permalink
Merge pull request #325 from SELab-2/backend_extras
Browse files Browse the repository at this point in the history
Backend fixes
  • Loading branch information
LGDTimtou authored May 23, 2024
2 parents b88ea4f + 0b8a71f commit 9b00687
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/models/indiening.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ def save(self, *args, **kwargs):

if "temp" in self.bestand.name:
old_file = self.bestand
new_path = self.bestand.name.replace(
old_file_name = old_file.name
new_path = old_file.name.replace(
"temp", f"indiening_{self.indiening_id}"
)
default_storage.save(new_path, ContentFile(old_file.read()))
self.bestand.name = new_path
super(Indiening, self).save(*args, **kwargs)
old_file.storage.delete(old_file.name)
default_storage.delete(old_file_name)
else:
super(Indiening, self).save(*args, **kwargs)

Expand Down

0 comments on commit 9b00687

Please sign in to comment.