我有一个简单的场景,其中有一个具有名称、电子邮件和关注者属性的用户类。
class User(ndb.Model):
name = ndb.StringProperty(required = True)
search_name = ndb.StringProperty(required = True)
pw_hash = ndb.StringProperty(required = True)
email = ndb.StringProperty()
follows = ndb.KeyProperty(Follow, repeated=True)
followers = ndb.KeyProperty(User, repeated=True)
执行此操作时出现错误。
File "C:\ujjal\my project\cravel\code2\Users.py", line 46, in User
followers = ndb.KeyProperty(User, repeated=True)
NameError: name 'User' is not defined
INFO 2012-09-11 11:45:23,953 dev_appserver.py:2967] "GET / HTTP/1.1" 500 -
任何关于如何对“追随者”属性建模的建议都将受到高度赞赏。提前致谢