This topic created in 1155 days ago, the information mentioned may be changed or developed.
我知道有 upload_to 参数可以指定目录和文件名生成规则,比如:
```
file = models.FileField('附件', upload_to='uploads/')
```
这样写的话,图片是传到了 uploads 目录下,但是数据库里面 file 字段存的也是 uploads/library-bg1.jpg ,我想数据库只保存 library-bg1.jpg ,有没有办法实现?
 |
|
1
hackerfans Feb 28, 2023
视图里自己写方法,没必要非得用 FileField
|