I have db model, where one property has auto_now_add=True. But looks like it doesn’t work as I’ve expected – it is updated each time when put is called (I use my own key_name, so second/third/N call of put doesn’t really create new record – just update it).
Here is the code:
class User(db.Model):
id = db.IntegerProperty()
added = db.DateTimeProperty(auto_now_add=True)
name = db.StringProperty()
...
# this handler can be called several times
def get(self):
user = User(key_name="id"+unique_user_id)
user.id = unique_user_id
user.name = current_name
user.put()
You are recreating the entity each time, here is how the code should look like: