【发布时间】:2010-10-25 21:14:54
【问题描述】:
我有一个这样的模型
def upload_location(instance, filename):
return 'validate/%s/builds/%s' % (get_current_user(), filename)
class MidletPair(models.Model):
jad_file = models.FileField(upload_to = upload_location)
jar_file = models.FileField(upload_to = upload_location)
upload_to=tempfile.gettempdir()
如何在upload_location()中获取当前用户...?
旁注:查找 django 的东西令人困惑,因为网上有很多 1.0 之前的东西。
【问题讨论】:
标签: python django django-models upload