Snippet List
**Description**
A filestorage system that
+ is whitlisted,
+ changes the file name and targeting directory to put the file in - with respect to (runtime) instance information.
+ replaces files if they exists with the same name.
Kudos to [jedie](http://djangosnippets.org/users/jedie/) - http://djangosnippets.org/snippets/977/
- forms
- filefield
- whitelist
- filestorage
- overwrite
- file-extension
I needed to overwrite files on update (not create new ones) but also a validation which would prevent to upload 2 files with the same name.
The CustomCheckFiled triggers a validation passing the filename and model instance. If the validation returns false, the validation error_message will be displayed in admin.
The OverwriteStorage is needed because the default storage alters the name if such name already exists. Enjoy.
- validation
- FileFiled
- FileSystemStorage
- overwrite
2 snippets posted so far.