继http://mongoengine.org/docs/v0.4/guide/gridfs.html文档中关于mongoengine的FileField我做了以下内容:为什么我得到'FileField'对象没有'put'属性?
在我的模型
files = ListField(FileField())
在我的测试代码
# Create an entry
photo = FileField()
f = open('/home/foo/marmot.jpg', 'r')
photo.put(f, content_type='image/jpeg')
entry.files = [photo,]
试图跟随文档,但是我得到一个错误:
Traceback (most recent call last):
File "/home/bar/tests.py", line 76, in test_MongoDGACLogook_creation
photo.put(f, content_type='image/jpeg')
AttributeError: 'FileField' object has no attribute 'put'
我是密西西比州显而易见的东西?
感谢
这个答案如何将FileFields放入ListField? – MFB 2014-06-23 18:51:30