Login

Tag "overwrite"

Snippet List

Whitelisted overwriting FileSystemStorage

**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
Read More

Unique FileFiled or FileFiled with custom validation and overwriting files on update

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
Read More

2 snippets posted so far.