我试图让 MongoEngine 与 Flask-Mongoengine 扩展一起工作,但是每当我使用 ListField 时,我都会收到以下错误:
if field.field.choices:
AttributeError: 'NoneType' object has no attribute 'choices'
这是我的代码:
class Business(db.Document):
name = db.StringField(required=True)
address = db.StringField()
location = db.GeoPointField()
tags = db.ListField()
area = db.ReferenceField(Area, dbref=True)
contact = db.EmbeddedDocumentField(Contact)
details = db.EmbeddedDocumentField(details)