Work in progress: django-imagekit but for all types of media files (movies, PDFs etc.). + private media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
731 B

# # -*- coding: utf-8 -*-
# from __future__ import unicode_literals
# # Erik Stein <code@classlibrary.net>, 2016
# import os
# from django.utils.text import slugify
# def get_upload_path(instance, filename):
# """
# Returns /<uuid_hex>/original/<slugified_filename.ext>
# where
# - uuid is taken from instance,
# - filename is slugified and shortened to a max length including the extension.
# """
# name, ext = os.path.splitext(filename)
# name = slugify(name)
# name = name[:(FILENAME_MAX_LENGTH - len(ext))]
# filename = "%s%s" % (name, ext)
# return os.path.join(
# instance.get_uuid(),
# instance.STORAGE.ORIGINAL_FILE_PREFIX,
# filename
# )