阅读背景:

如果在django中选择了新文件,如何才能更新图像表单字段?

来源:互联网 

I have a custom profile form with an image field where users can upload a profile picture along with some other fields. It works fine so far. The problem is, when submitting the form, it always uploads and updates the field, even when a user didn't choose a file. So a user has submitted the form and uploaded a picture. He/she then comes back at a later point to update some other field, but not the picture. After submitting the form the profile pic is gone and has resetted to default. How do I get the image field to update only if a new file has been chosen?I have a custom profile form with an image fiel




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: