我有Document
这样EmbeddedDocument
的mongoengine
。怎么可以为大师创作ReferenceField
...EmbeddedDocument
大师的Document
意思Document
是嵌入我的EmbeddedDocument
class Activity(EmbeddedDocument):
user = ReferenceField(Profile)
followed_user = ReferenceField(Profile)
created_date = DateTimeField(default=datetime.datetime.now, required=True)
class Profile(Document):
username = StringField(max_length=255, required=True)
password = StringField(max_length=255, required=True)
email = StringField(max_length=255, required=True)
activities = ListField(EmbeddedDocumentField(Activity))
蟒蛇说:
NameError: name 'Profile' is not defined