I have lots of views manipulating entities of same kind:
def view1(request, key):
user = ndb.Key(urlsafe=key).get()
user.x = 1
user.put()
...
de
Wrap your get and put into a transaction. This will ensure you cannot stomp over a different update.
You can read more about transactions with the NDB Client Library documentation.
In your code, you could for example just use the NDB transaction decorator:
@ndb.transactional(retries=1)
def view1(request, key):
user = ndb.Key(urlsafe=key).get()
user.x = 1
user.put()
...
@ndb.transactional(retries=1)
def view2(request, key):
user = ndb.Key(urlsafe=key).get()
user.y = 2
user.put()