views:

29

answers:

2

I'm creating a new entity like:

some_model = ModelName(
    attr1 = ...,
    attr2 = ...,
    attr3 = ...,
    attr4 = ...
).put()

Is there anyway to get the key of this newly created entity? I tried doing some_model.key() put that does not work.

+1  A: 

Apparently some_model is the key.

blcArmadillo
+1  A: 

The return value of the put() method is the key of the newly inserted entity. You can also call .key() on the model - after you've inserted it.

Nick Johnson