diff --git a/opentech/apply/funds/models/submissions.py b/opentech/apply/funds/models/submissions.py index 7ad891425f671ee2609d583c4507c95dc467a4d2..6965755c0ca18c0ffa9785d54a0af32e19ab0ffb 100644 --- a/opentech/apply/funds/models/submissions.py +++ b/opentech/apply/funds/models/submissions.py @@ -283,7 +283,10 @@ class ApplicationSubmission( editable=False, ) - private_storage = PrivateMediaStorage() + if settings.DEBUG: + submission_storage = DefaultStorage() + else: + submission_storage = PrivateMediaStorage() # Meta: used for migration purposes only drupal_id = models.IntegerField(null=True, blank=True, editable=False) @@ -356,7 +359,7 @@ class ApplicationSubmission( def save_path(self, file_name): file_path = os.path.join('submissions', 'user', str(self.user.id), file_name) - return self.private_storage.generate_filename(file_path) + return self.submission_storage.generate_filename(file_path) def handle_file(self, file): # File is potentially optional @@ -367,11 +370,11 @@ class ApplicationSubmission( # file is not changed, it is still the dictionary return file - saved_name = self.private_storage.save(filename, file) + saved_name = self.submission_storage.save(filename, file) return { 'name': file.name, 'path': saved_name, - 'url': self.private_storage.url(saved_name), + 'url': self.submission_storage.url(saved_name), } def handle_files(self, files):