Re: Image deduplication and upload_to

2010-05-31 Thread Ricardo Bánffy
Thanks. I have successfully made a lobotomized version I called OverwritingStorage that extends FileStorage and overrides get_available_name, _save and delete (and offers a hashed_path classmethod to be used in upload_to callables) http://djangosnippets.org/snippets/2044/ Now my problem is not be

Re: Image deduplication and upload_to

2010-05-27 Thread Nuno Maltez
Hi, I think it's designed to do that. See the behaviour of the save/get_available_name methods on core/files/storage.py (in the django source). Maybe you can write your own storage that overrides this (never tried it, but should work). Nuno 2010/5/26 Ricardo Bánffy : > Hi folks. > > I want to pr

Image deduplication and upload_to

2010-05-26 Thread Ricardo Bánffy
Hi folks. I want to prevent the duplication of uploaded images. For that, I am using the upload_to property of ImageField set to a callable that computes the md5 hash of the uploaded file data and returns a file name. This should work _but_ when I save the model, the filename I gave back in the fu