1
我就遇到了這個功能(?)其中字典是隱式轉換爲ndb.Model對象隱快譯通在Python谷歌應用程序引擎ndb.Model轉換
我有以下ndb.Model類
class DateOfBirth(ndb.Model)
day = ndb.IntegerProperty()
month = ndb.IntegerProperty()
year = ndb.IntegerProperty()
class User(ndb.Model):
dob = ndb.StructuredProperty(DateofBirth)
而且在一個地方,當我在一個字典
user.dob = {"day": 12, "month": 10, "year": 1983}
它沒有抱怨過意外,看起來像它的工作。
這個預期,還是我預計今後會遇到的問題(因爲這種行爲不是記錄,並有望打破任何時間)
哇,我不知道這並! – marcadian
這是打算。事實上,解開一個字典(或調用填充字典)是創建實體的簡單方法。 – janscas