Matt Matt - 1 year ago 84
Python Question

Wait for datastore changes before redirecting

Very similar to this question, except that the answer is not suitable.

I populate a table from a datastore query, then there is a link allowing the user to delete a specific row. Clicking the link goes to a url that deletes the row from the datastore then redirects back to the table.

Changes more often than not aren't shown in the table until reloading again.

Easy solution is to redirect to another page, that uses a javascript redirect to add a delay of a couple of seconds. Other alternative is to send details back to the page like

and then make sure that item is missed from the table. That's a pain though.

Answer Source

The answer is with ancestor queries.

Create the entities with a parent. When one of the entities is deleted, you can run an ancestor query for your table list view which will have strong consistency when data is changed.

Example ancestor query:

tom = Person(key_name='Tom')

photo_query = Photo.all()