Reference file in storage backend by name and not by path.

This commit is contained in:
Roberto Rosario
2015-07-13 02:03:30 -04:00
parent 8c603ce2ff
commit d5b5927c77
4 changed files with 9 additions and 9 deletions

View File

@@ -34,11 +34,11 @@ class SharedUploadedFile(models.Model):
super(SharedUploadedFile, self).save(*args, **kwargs)
def delete(self, *args, **kwargs):
self.file.storage.delete(self.file.path)
self.file.storage.delete(self.file.name)
return super(SharedUploadedFile, self).delete(*args, **kwargs)
def open(self):
return self.file.storage.open(self.file.path)
return self.file.storage.open(self.file.name)
@python_2_unicode_compatible