我有一个这样的模型:
class Group(db.Model):
name = db.StringProperty()
description = db.TextProperty()
有时在执行以下查询时:
groups = Group.all().order("name").fetch(20)
或者
groups = Group.all()
我收到这样的错误消息:
Traceback (most recent call last):
File "/opt/google_appengine/google/appengine/ext/webapp/__init__.py", line 501, in __call__
handler.get(*groups)
File "/home/al/Desktop/p/mwr-dev/main.py", line 638, in get
groups = Group.all()
AttributeError: type object 'Group' has no attribute 'all'
但是当我使用具有相同含义的 GQL 查询时,一切正常。
为什么会这样?我不明白为什么 GAE 认为“全部”是属性?
更新:哎呀......我发现我也有与模型命名相同的请求处理程序;(