python 2.7 应用引擎 1.8.5.1039
对于我的一生,我无法弄清楚我的 InventoryItem Expando 模型返回无。我的身份证有效。我检查数据存储的次数比我想记住的要多。我是否必须将 Expando 模型作为父模型才能正常工作?
class InventoryItem(db.Expando):
def toDict(self):
d = db.to_dict(self)
d['id'] = self.key().id()
return d
inventoryItem = InventoryItem(parent=toon.getInventory())
for k,v in item.iteritems():
setattr(inventoryItem,k,v)
inventoryItem.put()
inventoryItem_id = self.request.get("id")
logging.info(inventoryItem_id)#5770237022568448
item = InventoryItem.get_by_id(long(inventoryItem_id))#returns None