Given a NDB Datastore (Google AppEngine) model definition:
class Customer(ndb.Model):
products = ndb.StructuredProperty(Product, repeated=True)
The model Customer defines a repeated sub-model, called Product. How can I get the name of the sub-model, in this case "Product"?
You can try:
getattr(Customer, 'products')._modelclass
Although if you use any method/properties prefixed with a _
you will be responsible for underlying API changes to the ndb library.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.