Python 不支持索引?

Python 不支持索引?,python,google-app-engine,google-cloud-datastore,python-2.7,Python,Google App Engine,Google Cloud Datastore,Python 2.7,我收到以下错误消息: TypeError:“城市”对象不支持索引 当这是我的模型时: class City(db.Model): region = db.ReferenceProperty() name = db.StringProperty() image = db.BlobProperty() vieworder = db.IntegerProperty() areacode = db.IntegerProperty() 这是我的问题 items = Item.all(

我收到以下错误消息:

TypeError:“城市”对象不支持索引

当这是我的模型时:

class City(db.Model):
  region = db.ReferenceProperty()
  name = db.StringProperty()
  image = db.BlobProperty()
  vieworder = db.IntegerProperty()
  areacode = db.IntegerProperty()
这是我的问题

items = Item.all().filter('modified >', timeline).filter('published =',                 True).order('-modified').filter('cities =',city[0].key()).fetch(PAGESIZE + 1)`
您能告诉我应该如何进行查询或建模我的类定义吗?我使用
listproperty(db.Key)
来建模与引用的关系,我认为我可以像上面的查询一样进行过滤,因为它只对一个项目有效。我该怎么办

city[0].key()
是你犯错误的原因。你可能认为城市是一个列表,但它实际上是一个单独的项目,或者类似的项目