0

I creating CRUD system with searching of item what is POST request and then want make some operation like rename, delete etc. But i have problem with make redirect back to searched item.

This is first POST:

@app.route("/search", methods = ["GET", "POST"])
def search():
form = SearchForm()

if form.validate_on_submit():
    term = form.term.data
    ...

    ...
    return render_template("pages/spareparts/result_search.html", form = form, items=items)       

second POST

@app.route('/remove', methods = ["POST"])
def remove():
...

...
return redirect(url_for('search'))

After second POST go back without searched items need enter one more time... How to redirect back with first POST

Meybe concept is bad if have someone another idea can put here.

Roman
  • 83
  • 1
  • 1
  • 10
  • Does this answer your question? [Make a POST request while redirecting in flask](https://stackoverflow.com/questions/15473626/make-a-post-request-while-redirecting-in-flask) – Danila Ganchar Mar 11 '21 at 13:57
  • No because this not handle first POST request. I need go from second route back to first with first POST request. You making first POST request "search all item" and then you want make some modification based on ID and you need redirect on first route with POST request what you put first time – Roman Mar 11 '21 at 20:19
  • I start thinking need use some javascript for async operation or concept is bad use two POST request – Roman Mar 11 '21 at 20:26

0 Answers0