python - How to get last inserted item's key in google app engine -


I am working with Google App Engine and Python.
There is a model with my item.
Immediately after I insert an item with Item.put () - I want to take this key and want to redirect to a page using this key

  redirectUrl = " / View / key /% s / "% item.key auto redirect (redirect URL)  

In addition, item.put () returns the key as a result, so it is necessary to immediately bring that key immediately - just change your sequence, like

  item .p Ut () redirectUrl = "/view / key /% s /"% item.key ()  

in

  k = item.put () RedirectUrl = "/ view / key /% s /"% k  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -