﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6714	let update_to accept a callable	Griffith Rees <griff.rees@…>	nobody	"It would be nice if the upload_to parameter on FileFields accepted a callable as an argument. It could be called with the model instance as its only variable the first time the instance needed to be saved to disk (afterwards, it should rely on the database entry for the path).

Currently, it only accepts a formatting string, which means you cannot, for example, upload files to directories based on their filesize or other data (such as other attributes of the model instance).


{{{
class IssuePrintEdition(model.Model):
    issue = ForeignKey(Issue) # The issue this print edition is related to
    section = ForeignKey(Section)
    file = FileField(upload_to=upload_path)
    
def upload_path(instance):
    return ""issues/%s/%s"" % (instance.issue.title, instance.section)
}}}
"		closed	Core (Other)	dev		duplicate	FileField Models	andrew@…	Unreviewed	0	0	0	0	0	0
