我有一个如下所示的模型:

class test (db.Model) :
 tagList = StringListProperty()
 siteName = StringProperty()
.

我将标签存储在“ticllist”中,并希望运行一个查询,其中我可以在其标记列表中获取包含特定标记的所有测试实体。

这可能吗?

有帮助吗?

解决方案

只使用平等运算符。

q = test.all()
q.filter("tagList =", "some_tag")
q.fetch()
.

对于列表属性,App Engine将“等于”作为“包含”。

请参阅 http://code.google.com/appengine / docs / python / datastore / typesandpropertyclasses.html#listproperty 详细信息。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top