~netlandish/django-wiki

15a33eab1b8d9ea644fab7d678cdf57ef752e319 — Tae-lim Oh 11 years ago 64a22a8
adding custom storage backend option to images plugin
2 files changed, 5 insertions(+), 1 deletions(-)

M wiki/plugins/images/models.py
M wiki/plugins/images/settings.py
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