This question is really a follow on to this question
In python how can I make an html alert template know where it came from so it will return there, without making a different template for each exception?
I was thinking too much about the javascript “alert” which initiates in the html template, not in the python code. My “alert” starts in the python code itself, so I can just pass a “hidden” variable value to the template which tells where to return and capture that “hidden” value with the “def post” part of the python code.
No, this is still not quite complete. Do I have to import and use that urllib stuff, also?
It’s not remotely bulletproof, but checking the HTTP
Refererheader sounds sufficient for your needs. If you want more control over the return URL, you can simply pass it around a query parameter instead. Just make sure to percent-encode it.