django - sorl-thumbnail: random name in Thumbnail field -


i want use str(uuid.uuid4()) instead of name uploaded.

i have model:

class foo(models.model):    pic  = thumbnailfield(upload_to='pics', size=(200, 200)) 

i uploading hello_world.jpg , should save these named versions should saved example in 4ba9b397-da69-4307-9bce-e92887e84d2f.jpg.

how can that?

you handle in view:

myfile = request.files['file'] foo_model = foo() foo_model.pic.save("%s.jpg" % str(uuid.uuid4()), myfile, save=true) 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -