Code

Opened 7 years ago

Closed 7 years ago

#4113 closed (duplicate)

dynamic destinations for FileField.upload_to

Reported by: August Bigelow <wip@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

From my experience, the current setup for the FileField and ImageField attribute "upload_to" is too inflexible. While save_FIELD_file is very quick and easy, telling the core where to put that file is not. I think giving another class contribution could make things much more flexible.

I believe usage akin to this would work sufficiently:

class TestModel(Model):
    file = FileField()

some_number = 145
t = TestModel()
t.set_file_upload_to("desired/path/%s/" % some_number)

Giving the programmer the ability to change the destination folder on the fly would allow for more dynamic destinations. You'd be able to use IDs from other objects and use them here.

Attachments (0)

Change History (6)

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from FileField.upload_to issues to dynamic destinations for FileField.upload_to
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from 0.96 to SVN

comment:2 Changed 7 years ago by anonymous

Any update on this feature? This capability would make my life a whole lot easier!

comment:3 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Try the latest #3297

comment:4 Changed 7 years ago by PhiR

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

duplicate of #5029

comment:5 Changed 7 years ago by PhiR

  • Resolution worksforme deleted
  • Status changed from closed to reopened

comment:6 Changed 7 years ago by PhiR

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.