mongoengine FileFieldに関するhttp://mongoengine.org/docs/v0.4/guide/gridfs.htmlドキュメントに従って、次のことを行いました。
私のモデルでは
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'
明らかな何かが欠けていますか?
ありがとう