I have a protected view in my application that just accepts POST requests.
@app.route("/booking", methods=("POST", ))
@login_required
def booking():
arg1 = request.form.get("arg1")
arg2 = request.form.get("arg2")
When an unauthorized user tries to access this view, I want them to log in and then redirect here.
Currently, my login window is as follows:
@app.route("/login", methods=("GET", "POST"))
@login_required
def login():
do_login()
return redirect(request.args.get('next') or url_for('home'))
So what happens is a POST / reservation request (which is the “next” parameter), and I get the error DO NOT ALLOW.
The problem is that login () makes a GET request for booking (). I can get around this, but I'm not sure how to get the original POST enter the arguments from / booking? Any ideas to get around this?