![](/img/trans.png)
[英]ndb.StructuredProperty not calling ndb.PolyModel subclass methods
[英]Get name of subclass of ndb.StructuredProperty(subclass, repeated=True)
給定NDB數據存儲 (Google AppEngine)模型定義:
class Customer(ndb.Model):
products = ndb.StructuredProperty(Product, repeated=True)
Customer模型定義了一個名為Product的重復子模型。 如何獲取子模型的名稱,在本例中為“Product”?
你可以試試:
getattr(Customer, 'products')._modelclass
雖然如果使用前綴為_
任何方法/屬性,您將負責對ndb庫進行基礎API更改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.