0
내가 알아낼 수없는 애플리케이션 엔진에 문제가 있어요
:AppEngine에 NDB PolyModel 점점 속성
그래서 모든 ItemInHouse 쿼리 한 다음 내가하려고 할 때, 위의 클래스를 사용하여from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel
class Item(polymodel.PolyModel):
name = ndb.StringProperty()
type = ndb.StringProperty(choices=["Medical","Food"])
sub_category_type = ndb.StringProperty()
sub_category_sub_type = ndb.StringProperty()
class MedicalItem(Item):
med_sub_type = ndb.StringProperty()
can_split_item = ndb.BooleanProperty()
class ItemInHouse(ndb.Model):
item = ndb.StructuredProperty(Item)
amount_of_item = ndb.FloatProperty()
MedicalItem이있는 iteminhouse에 액세스하면 med_sub_type을 얻을 수 없습니다. 즉 :
itms = ItemInHouse.query(ItemInHouse.item.type == "Medical").fetch()
for itm in itms:
self.response.out.write(itm.item.med_sub_type)
itm.item.med_sub_type에서 오류가 발생합니다. 나는 시도했다 : itm.item._values["med_sub_type"].b_val
하지만 여전히 AttributeError를 던졌습니다. 'Item'객체에는 'med_sub_type'속성이 없습니다. 나는 class_
속성에서 Item
과 MedicalItem
속성을 볼 수 있지만 액세스 할 수는 없습니다. 어떤 아이디어?
감사 존
충분한 수요가있는 경우이를 구현하는 데 몹시 기뻐할 것입니다. – bossylobster
나는 그것이 굉장 할 것이라고 생각한다. – Jon