如果我希望图像保存在路径 'img/'currentdateMonthYear_ + category_+ 给定名称中,如何在模型中定义它。类别取决于我选择什么?
目前我这样描述我的模型:
class Image(models.Model):
title = models.CharField(max_length=50)
description = models.TextField()
hits = models.IntegerField()
timestamp = models.DateTimeField(auto_now_add=True)
thumb = models.ImageField(upload_to='photos...
tag = models.ForeignKey(Tag)
artist = models.ForeignKey(User)
storage = models.ForeignKey(Storage)
market = models.ForeignKey(Market)
Category = models.ForeignKey(Category)
Log = models.ForeignKey(Log)
def __unicode__(self):
return self.title