On 10/28/07, Justin Driscoll <[EMAIL PROTECTED]> wrote: > I may be missing something but lets say when you pass a string to > "upload_to" it functions basically as it does now, however, if you pass a > callable it takes the return value (the full relative path of the file, > including the filename, in relation to MEDIA_ROOT) and splits it into the > path and filename using os.path.split. > > my_file = models.FileField(upload_to=get_file_path) > > def get_file_path(obj, filename): > return "%s/%s/%s" % (datetime.now.strftime("%Y/%m/%d"), obj.id, > filename)
Hrm. That would require two different sets of semantics depending on the value passed in as the argument. I'm not really thrilled about that idea, but it certainly does seem like a better approach than anything else I've considered. I don't think there's a single tactic that will feel 100% appropriate, so any solution will probably feel at least a little bit dirty. Do any of the core devs have an opinion on this proposal? -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---