Last active
August 29, 2015 14:23
-
-
Save benzkji/5f14fef05021f325c7ef to your computer and use it in GitHub Desktop.
django-filer no subfolders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from filer.utils.files import get_valid_filename | |
def no_subfolders(instance, filename): | |
return get_valid_filename(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILER_STORAGES = { | |
'public': { | |
'main': { | |
'ENGINE': 'filer.storage.PublicFileSystemStorage', | |
'OPTIONS': { | |
'location': os.path.join(MEDIA_ROOT, 'filer'), | |
'base_url': '%sfiler/' % MEDIA_URL, | |
}, | |
'UPLOAD_TO': 'project.filer_upload_to.no_subfolders', | |
'UPLOAD_TO_PREFIX': '', | |
}, | |
'thumbnails': { | |
'ENGINE': 'filer.storage.PublicFileSystemStorage', | |
'OPTIONS': { | |
'location': os.path.join(MEDIA_ROOT, 'thumbs'), | |
'base_url': '%sthumbs/' % MEDIA_URL, | |
}, | |
}, | |
}, | |
'private': { | |
'main': { | |
'ENGINE': 'filer.storage.PrivateFileSystemStorage', | |
'OPTIONS': { | |
'location': os.path.join(MEDIA_ROOT, 'filer_private'), | |
'base_url': '%sfiler' % MEDIA_URL, | |
}, | |
'UPLOAD_TO': 'project.filer_upload_to.no_subfolders', | |
'UPLOAD_TO_PREFIX': '', | |
}, | |
'thumbnails': { | |
'ENGINE': 'filer.storage.PrivateFileSystemStorage', | |
'OPTIONS': { | |
'location': os.path.join(MEDIA_ROOT, 'private_thumbs'), | |
'base_url': '%sprivate_thumbs/' % MEDIA_URL, | |
}, | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment