I have a mini-search form on a Pyramid app webpage, where contents are read and processed upon POST request when user presses a Search
button.
I selected POST method of submitting since the web form is otherwise complex and processing them this way plays well with WTForms
as well as it seems default and convenient way of handling forms in Pyramid (if request.method == 'POST': ...
etc).
But that gets me a problem - I do not have query string (available in request.params
) anymore to form an URL that can be copied and pasted elsewhere to redo the search.
request.params
is a read-only NestedMultiDict
, so I can't add query parameters in there.
Web forms are rendered using Chameleon and in typical way (return {..}
for Chameleon template engine to get them and use for rendering HTML).
Is there a way of passing query string explicitly to the next request so that after pressing Search the user gets search query string added to URL? (I do not want to use kludges like HTTPFound
redirect to the same view, etc).
Search form is a classical example of a form which should use GET. Just use GET and get the correct behaviour for free :) I don't see anything requiring POST in your question.