mattes
mattes

Reputation: 9429

Get name of subclass of ndb.StructuredProperty(subclass, repeated=True)

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"?

Upvotes: 0

Views: 124

Answers (1)

someone1
someone1

Reputation: 3570

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.

Upvotes: 2

Related Questions