Django

Code

Ticket #4113 (closed: duplicate)

Opened 2 years ago

Last modified 2 years ago

dynamic destinations for FileField.upload_to

Reported by: August Bigelow <wip@rpgmaker.net> Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

04/24/07 07:44:09 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • needs_tests changed.
  • summary changed from FileField.upload_to issues to dynamic destinations for FileField.upload_to.
  • version changed from 0.96 to SVN.
  • needs_docs changed.
  • stage changed from Unreviewed to Design decision needed.

07/24/07 20:18:50 changed by anonymous

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

07/24/07 20:45:14 changed by Øyvind Saltvik <oyvind@saltvik.no>

Try the latest #3297

09/14/07 12:44:23 changed by PhiR

  • status changed from new to closed.
  • resolution set to worksforme.

duplicate of #5029

09/14/07 12:44:46 changed by PhiR

  • status changed from closed to reopened.
  • resolution deleted.

09/14/07 12:44:54 changed by PhiR

  • status changed from reopened to closed.
  • resolution set to duplicate.

Add/Change #4113 (dynamic destinations for FileField.upload_to)




Change Properties
Action