# # -*- coding: utf-8 -*- # from __future__ import unicode_literals # # Erik Stein , 2016 # import os # from django.utils.text import slugify # def get_upload_path(instance, filename): # """ # Returns //original/ # 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 # )