Reputation: 25
I'm working my way through Google's App Engine Guestbook example (to be found here: https://cloud.google.com/appengine/docs/standard/python/getting-started/creating-guestbook)
I'm trying to redirect the output (the Greetings) to another page as opposed to the index.html where they're currently displayed after a user presses the "Sign the Guestbook" button. I created a separate page called greetings.html where I copied the display code from the index.html page. However, I don't know how to modify guestbook.py to make the output go to the new page.
Upvotes: 0
Views: 943
Reputation: 11360
webapp2 has a built-in redirect
method:
return redirect('/some-path')
However, I think you would probably rather send the gathered data to the greetings.html
template? Under the POST
method, you could do:
template_values = {
'guestbook_name': guestbook_name,
# etc.,
}
template = JINJA_ENVIRONMENT.get_template('greetings.html')
self.response.write(template.render(template_values))
Upvotes: 1