以下代码的最后一行抛出错误“AttributeError: 'Notebooks' object has no attribute 'key_name'”。我需要为我的应用程序生成 key_name 结果,但不知道该怎么做。
from google.appengine.api import users
from models import Notebooks
user = users.get_current_user()
user_ID = user.user_id()
print user_ID
notebook = db.Query(Notebooks)
notebook.filter('user =', user_ID)
notebook.filter('deleteRequested =', False)
pages = notebook.fetch(limit=100)
for page in pages:
print page.user
print page.key_name
我的数据存储实体如下所示:
Edit Entity
Entity Kind Notebooks
Entity Key aghkZXZ-ZGVtb3IUCxIJTm90ZWJvb2tzIgVSb2dlcgw
Key Name Roger
deleteRequested (bool)
moreinfo (string)
user 185804764220139124118