Opened 9 months ago

Closed 9 months ago

#35057 closed New feature (wontfix)

Add a setting for project level callable/string for FileField's upload_to

Reported by: Vasanth Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: Files, models, storage
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Vasanth)

On the FileField, we have the option to define the default storage that the project uses globally with the option to override it at a field level manually.

It would be great to extend the same functionality to the upload_to argument as well. In some projects, we do find ourselves manually overriding it for every file & image field and it is one more check to remember / check during PRs.

It would be great if we could define a DEFAULT_UPLOAD_TO = "callable_or_string" so that it simplifies working on a project when collaborating with others

I did it ask around the forum and was told having a custom field was the only way to go at the moment (ref: https://forum.djangoproject.com/t/settings-upload-to-at-project-level-settings/26334)

Change History (2)

comment:1 by Vasanth, 9 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 9 months ago

Resolution: wontfix
Status: newclosed
Summary: [Feature request] Add a setting for project level callable/string for FileField's upload_toAdd a setting for project level callable/string for FileField's upload_to

Thanks for this ticket, however creating a new setting is always controversial (we already have many of them), especially if there is a way to achieve the same. You can start a discussion on DevelopersMailingList if you don't agree.

... was told having a custom field was the only way to go at the moment (ref: ​https://forum.djangoproject.com/t/settings-upload-to-at-project-level-settings/26334)

Yes and that's the right way to do it.

Note: See TracTickets for help on using tickets.
Back to Top