I am recently trying to make an aws S3 storage (I know there are a few 
libraries in there but I needed some customization). The storage works fine 
so far!

However, there are some implementation details on FileField and ImageField, 
in particular the function 
generate_filename
https://github.com/django/django/blob/master/django/db/models/fields/files.py#L310

that is called before saving a model (and its file/image field). That code 
assumes the file uses standar file paths based on your current operative 
system. This creates quite some complications on S3 for example where all 
the paths to simulate folders uses a "/", so if you are in Windows and your 
file name is something like "hello/my/file.txt" it will overwrite your file 
name to be "hello\\my\\file.txt" which is something I don't want as I have 
explicitly created an upload_to callable to generate a very specific file 
name (and that it shouldn't be changed).
Looking deeper it seems like the whole FileField implementation relies on a 
directory and file structure, which might not be always right.

How easy would it be to add customization to this? Is your only option 
defining your own FileFilend and ImageField classes that override this 
method?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/35f921f4-9c22-40fa-bbea-ebfcb4c5d91f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to