【发布时间】:2013-09-20 03:32:42
【问题描述】:
给定一个NDB Datastore (Google AppEngine) 模型定义:
class Customer(ndb.Model):
products = ndb.StructuredProperty(Product, repeated=True)
模型 Customer 定义了一个重复的子模型,称为 Product。如何获取子模型的名称,在本例中为“产品”?
【问题讨论】:
-
getattr(Customer, 'products')返回StructuredProperty(Product, 'products', repeated=True)。也许这有帮助?
标签: python google-app-engine python-2.7 google-cloud-datastore app-engine-ndb