TypeError: Cannot filter a non-Node argument; received True

TypeError: Cannot filter a non-Node argument; received True

我正在尝试使用可能值列表查询 GAE 数据存储。类似于:

list_of_assigned_therapists = [ ... ]
qry = Appointment.query(Appointment.therapist in list_of_assigned_therapists)

但是我得到了标题中的错误。我发现的唯一参考是使用模型中未声明的属性时。但我的模型看起来像

class Appointment(BaseModel):
    therapist = ndb.KeyProperty(MyUser, required = True)
    Patient = ndb.KeyProperty(MyUser)
    when = TZDateTimeProperty(required = True)
    status = ndb.IntegerProperty(default = 1)

和简单查询

qry = Appointment.query(Appointment.therapist == selected_therapist_key)

工作正常,从来没有错误。

我做错了什么???

'in' 子句没有像您那样使用。您需要这样做:

qry = Appointment.query(Appointment.therapist.IN(list_of_assigned_therapists))

here