DjangoModel FileField显示文件名
model
class Scene(models.Model):
... ...
writeup = models.FileField(verbose_name=u"场景解答手册", upload_to=uploadpath)
def uploadpath(instance, filename):
# MEDIA_ROOT/<model_name>_<uuid4>.<fileext>
return '{0}_{1}{2}'.format(instance._meta.model_name, str(uuid.uuid4()),
'.pdf')