Storage#

Custom Django file-storage backends used wherever FileField / ImageField uploads benefit from non-default behaviour.

OverwriteStorage#

A FileSystemStorage subclass that overwrites the existing file on the disk when a new file with the same name is uploaded – instead of Django’s default “append _<random>” rename behaviour.

Use it on a FileField / ImageField where the upload path is deterministic per record (e.g. staking/<pk>/<filename>) and you want a re-upload to replace, not duplicate.

class richy.core.storage.OverwriteStorage(*args, **kwargs)[source]#

Bases: FileSystemStorage

Storage that removes already existing file when checking if the new filename isavailable.