Hello everyone!
I made the mistake of accepting a feature request without suggesting to have a conversation about it here first, so in order to fix that, I’m proxying the reporter to get feedback about this proposal:
https://code.djangoproject.com/ticket/34540
As I mentioned in my comment, I don’t see a need to evaluate the storage
callable at field creation time, and I also think there is value in having consistency between upload_to
and storage
.
1 Like
And i was sooo close haha.
I raised this issue as I tried replacing the upload_to callable with the new storage callable under the impression that they were similar features not realising the callable was being invoked at build time.
This functionality would be particularly useful as to set storage dynamically at request level similar to the DatabaseRouter (a StorageRouter would be ideal but I’ll take what i can get)
Given the example on the ticket using a threading.Local()
I’d imagine a Routing Storage that proxied to an entry in storages
would be simple enough to implement already…
(Much more so than adjusting to allow a callable rather than an instance I’d imagine — but I didn’t look into how disruptive that would be…)
1 Like