Skip to content

Commit

Permalink
Set names again and again when overwriting
Browse files Browse the repository at this point in the history
Overwriting really is a dumb idea.
  • Loading branch information
matthiask committed Mar 18, 2018
1 parent ebed40e commit c453de1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cabinet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ def save(self, *args, **kwargs):
new_file._committed = True
setattr(self, new_file.field.name, original_file_name)

# Better be safe than sorry:
new_file.name = original_file_name
self.file_name = os.path.basename(new_file.name)

super().save(*args, **kwargs)

else:
Expand Down

0 comments on commit c453de1

Please sign in to comment.