Login

Tag "FileSystemStorage"

Snippet List

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

1 snippet posted so far.