然而,我得到了一个错误,我认为这是一个双重储蓄的问题?(保存我的图像,然后保存包含图像的整个表单)。我想在保存映像时执行commit=False,但这似乎是不可能的。instance.image.save(filename, quality=60)
返回最后一行的'JpegImageFile' object has no attribute '_committed'错误(instance.save())
有人能辨认出问题吗?
在将对象的属性插入到DB之前,我希望使用Falsk-SQLAlachemy更改它的属性。我尝试使用before_models_committed信号,但它似乎被破坏了,所以我尝试models_commited (并重新提交更改),并得到以下错误:
from app import dbfrom flask.ext.sqlalchemy import models_committed
class
http://www.gunnerkrigg.com//comics/00000001.jpg').content)f.close()AttributeError: 'file' object has no attribute '_committed'
我在谷歌上搜索了一段时间,我知道用id命名图像的方法可能有问题