M wiki/plugins/attachments/models.py => wiki/plugins/attachments/models.py +4 -1
@@ 73,7 73,10 @@ def upload_path(instance, filename):
import random, hashlib
m=hashlib.md5(str(random.randint(0,100000000000000)))
upload_path = path.join(upload_path, m.hexdigest())
- return path.join(upload_path, filename + '.upload')
+
+ if settings.APPEND_EXTENSION:
+ filename += '.upload'
+ return path.join(upload_path, filename)
class AttachmentRevision(BaseRevisionMixin, models.Model):
M wiki/plugins/images/models.py => wiki/plugins/images/models.py +2 -1
@@ 52,7 52,8 @@ class ImageRevision(RevisionPluginRevision):
image = models.ImageField(upload_to=upload_path,
max_length=2000, height_field='height',
- width_field='width', blank=True, null=True)
+ width_field='width', blank=True, null=True,
+ storage=settings.STORAGE_BACKEND)
width = models.SmallIntegerField(blank=True, null=True)
height = models.SmallIntegerField(blank=True, null=True)
M wiki/plugins/images/settings.py => wiki/plugins/images/settings.py +3 -0
@@ 3,6 3,9 @@ from django.conf import settings as django_settings
# Where to store images
IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGE_PATH', "wiki/images/%aid/")
+from django.core.files.storage import default_storage
+STORAGE_BACKEND = getattr(django_settings, 'WIKI_STORAGE_BACKEND', default_storage)
+
# Should the upload path be obscurified? If so, a random hash will be added to the path
# such that someone can not guess the location of files (if you have
# restricted permissions and the files are still located within the web server's