更新应用引擎实体

Gol*_*ird 4 python google-app-engine

如何更新应用引擎中的现有记录.

Mic*_*zcz 41

只要实体定义了一个键,它就会更新put():

record = Record(value='foo')
# This creates a new record
record.put()

record.value = 'shmoo'
# This updates it
record.put()

key = record.key()
record2 = Record.get(key)
record2.value = 'bar'
# Yet again this updates the same record
record2.put()
Run Code Online (Sandbox Code Playgroud)

  • 我不敢相信这不是答案......嘿大家,这是正确的答案:O谢谢Michal. (2认同)