Login

Snippets by rbanffy

Snippet List

Overwriting file storage

Useful if you can make sure your files will never collide unless they share the same contents. You point to the storage parameter when you declare an ImageField and use the hashed_path class method (seemed to make sense to bundle it with the class) to build a custom upload_to method that has to generate the path based on the file contents. Combining both will allow you to deduplicate files uploaded repeatedly.

  • file storage
Read More

rbanffy has posted 1 snippet.