这里可能令人困惑的是,键没有直接显示在模型声明中,因此
name =db.StringProperty不需要示例中的位。
get_or_insert将键名作为其第一个(必需)参数,因此您正在寻找类似以下的代码:
person = Person.get_or_insert('Peter')# other interesting & useful pre here...# later, maybe we need to retrieve that key name from the object:name = person.key().name()assert(name == "Peter")


