我做错了什么?
from google.appengine.ext import db
class Owner(db.Model):
things = db.ListProperty(db.Key)
class Thing(db.Model):
pass
t1 = Thing(key_name='thing1')
t2 = Thing(key_name='thing2')
t1.put()
t2.put()
o = Owner(key_name='me')
o.things = [t1.key(), t2.key()]
o.put()
result = Owner.all().filter('things=',t1).fetch(10)
print result # returns empty list!!
答案 0 :(得分:1)
第一个过滤器参数中的属性名称和运算符之间必须有空格。
为:
Owner.all().filter('things=',t1)
好:
Owner.all().filter('things =',t1)