From 15a33eab1b8d9ea644fab7d678cdf57ef752e319 Mon Sep 17 00:00:00 2001 From: Tae-lim Oh Date: Wed, 16 Jan 2013 17:25:03 +0900 Subject: [PATCH] adding custom storage backend option to images plugin --- wiki/plugins/images/models.py | 3 ++- wiki/plugins/images/settings.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wiki/plugins/images/models.py b/wiki/plugins/images/models.py index 67812b3f..9db0d17b 100644 --- a/wiki/plugins/images/models.py +++ b/wiki/plugins/images/models.py @@ -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) diff --git a/wiki/plugins/images/settings.py b/wiki/plugins/images/settings.py index 2f9489cf..8069f2fd 100644 --- a/wiki/plugins/images/settings.py +++ b/wiki/plugins/images/settings.py @@ -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 -- 2.45.2