请参阅django.core.files.File的django文档
其中fd是打开文件对象:
model_instance.image_field.save('filename.jpeg', fd.read(), True)
上一篇 Django {{MEDIA_URL}}空白@DEPRECATED
下一篇 UnicodeEncodeError:“ ascii”编解码器无法编码字符
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号