Skip to content

Commit

Permalink
Revert "Updated StoredUpload to address point in issue ImperialColleg…
Browse files Browse the repository at this point in the history
…eLondon#31"

This reverts commit 40fb867.
  • Loading branch information
pasevin committed Feb 18, 2020
1 parent 15c7f2d commit 995721f
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions django_drf_filepond/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
local_settings, 'UPLOAD_TMP',
os.path.join(local_settings.BASE_DIR, 'filepond_uploads'))

FILEPOND_FILE_STORE_PATH = getattr(local_settings, 'FILE_STORE_PATH', None)


@deconstructible
class FilePondUploadSystemStorage(FileSystemStorage):
Expand All @@ -41,28 +39,7 @@ def __init__(self, **kwargs):
super(FilePondUploadSystemStorage, self).__init__(**kwargs)


@deconstructible
class FilePondStoredSystemStorage(FileSystemStorage):
"""
Subclass FileSystemStorage to prevent creation of new migrations when
using a file store location passed to FileSystemStorage using the
location attribute. Instead the location is applied dynamically on
creation of the subclass avoiding detection of changes by the migration
system.
Addresses #13. Fix is based on fix for similar issue in
https://github.com/julen/pootle/commit/fd7800050172549e9f31544843b986691290ddc2
"""

def __init__(self, **kwargs):
kwargs.update({
'location': FILEPOND_UPLOAD_TMP,
})
super(FilePondStoredSystemStorage, self).__init__(**kwargs)


storage = FilePondUploadSystemStorage()
stored_storage = FilePondStoredSystemStorage()


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -108,7 +85,7 @@ class StoredUpload(models.Model):
validators=[MinLengthValidator(22)])
# The file name and path (relative to the base file store directory
# as set by DJANGO_DRF_FILEPOND_FILE_STORE_PATH).
file = models.FileField(storage=stored_storage, max_length=2048)
file = models.FileField(max_length=2048)
uploaded = models.DateTimeField()
stored = models.DateTimeField(auto_now_add=True)
uploaded_by = models.ForeignKey('auth.User', null=True, blank=True,
Expand Down

0 comments on commit 995721f

Please sign in to comment.