Skip to content

Commit

Permalink
Bestanden werden niet deftig in hun juiste datafolder gestoken
Browse files Browse the repository at this point in the history
  • Loading branch information
LGDTimtou committed May 23, 2024
1 parent f249a68 commit 0b8a71f
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 0b8a71f

Please sign in to comment.