我正在使用gae-boilerplate(webapp2和jinja2)。我的模型如下所示:如何通过谷歌应用引擎引用实体使用NDB
class Location(ndb.Model):
x = ndb.FloatProperty()
y = ndb.FloatProperty()
class Criterium(polymodel.PolyModel):
name = ndb.StringProperty(required=True)
user = ndb.KeyProperty(kind='User')
priority = ndb.IntegerProperty(required=True)
class Work(Criterium):
location = ndb.StructuredProperty(Location)
class Friend(Criterium):
location = ndb.StructuredProperty(Location)
我有一个来自Criterium模型的所有记录的表。我想在那里添加一个删除链接,但我不知道为了引用特定的实体而使用它来传递什么参数。我的处理程序是这样的:
def get(self):
criteria = Work.query().order(-Criterium.priority, Criterium.name)
self.view.list_columns = [('name', 'Name'),
('priority', 'Priority'),
('className', 'Type')]
self.view.criteria = criteria
self.view.count = criteria.count()
params={}
self.render_template('list.html', **params)
似乎是一个简单的问题,却一直在挣扎了一整天...提前感谢!
单数标准是'标准',而不是'标准'。 – 2013-03-19 16:27:29
谢谢。不知何故,我不喜欢“标准”这个词。 – 2013-03-19 17:35:19