我在python2.7中使用googleappengine,并尝试复制在https://github.com/GoogleCloudPlatform/appengine-paging-python/blob/master/suggest_cursor.py上给出的示例,以便在页面内部使用游标分页(请参见https://developers.google.com/appengine/articles/paging)
在数据模型.py在
class Feedback(db.Model):
user = db.ReferenceProperty(User)
subject = db.StringProperty()
text = db.TextProperty(default='')
created = db.DateTimeProperty(auto_now_add=True)
我的代码看起来很相似,但我有错误:
(一)
^{pr2}$2)删除-query=datamodel.Feedback.all()订单(datamodel.Feedback.created.已创建)结果就是这个错误
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2614, in order
if property.startswith('-'):
AttributeError: 'DateTimeProperty' object has no attribute 'startswith'
你知道为什么这不能像预期的那样工作吗?在
ndb
和db
是完全不同的模块;不能使用ndb示例代码并期望它在db中工作。在您需要为
.order()
调用提供带引号的属性名:相关问题 更多 >
编程相关推荐