Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#1994 closed enhancement (duplicate)

[patch] Custom upload_to per instance of FileField

Reported by: parlar@… Owned by: nobody
Component: Core (Other) Version:
Severity: normal Keywords: fs-rf-fixed
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I find myself constantly limited by the upload_to field for FileField. Namely, I often want to specify different upload_to directories on an individual basis, not just wanting to dump all files into one directory, or use the strftime.

This patch addresses that by adding an optional keyword argument 'upload_to' to the save_XXX_file method.

Attachments (2)

upload_to.diff (3.1 KB) - added by anonymous 10 years ago.
db-api.diff (1.2 KB) - added by parlar@… 10 years ago.
Documentation patch for the new keyword

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by anonymous

comment:1 Changed 10 years ago by parlar@…

  • Component changed from Admin interface to Core framework

Forgot to set the Component

Changed 10 years ago by parlar@…

Documentation patch for the new keyword

comment:2 Changed 10 years ago by parlar@…

Just wanted to also note that this patch is 100% backwards compatible. If you choose not to use the new keyword when manually calling the save_XXX_file method, then the behaviour will be the same as it is now.

comment:3 Changed 9 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 9 years ago by parlar@…

Well, I wrote this patch a *long* time ago. I don't know if it's still the best way to do it, but I do believe that FileField needs *some* kind of easy way to do custom directories.

comment:5 Changed 9 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from new to closed

Closing in favor of #5361.

comment:6 Changed 9 years ago by anonymous

  • Keywords fs-rf added

comment:7 Changed 8 years ago by Gulopine

  • Keywords fs-rf-fixed added; fs-rf removed
Note: See TracTickets for help on using tickets.
Back to Top