This repository has been archived on 2021-06-29. You can view files and clone it, but cannot push or open issues or pull requests.
2014-03-28 16:50:52 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def filer_generate_randomized(instance, filename):
|
|
|
|
import uuid
|
2014-04-23 15:16:00 +00:00
|
|
|
uuid_str = u'{}'.format(uuid.uuid4())
|
2014-03-28 16:50:52 +00:00
|
|
|
random_path = u"%s/%s/%s" % (uuid_str[0:2], uuid_str[2:4], uuid_str)
|
|
|
|
name, extension = os.path.splitext(filename)
|
2014-05-19 22:19:19 +00:00
|
|
|
filename = u'{}{}'.format(
|
2014-04-23 15:16:00 +00:00
|
|
|
uuid.uuid4(), extension
|
2014-03-28 16:50:52 +00:00
|
|
|
)
|
|
|
|
return os.path.join(random_path, filename)
|