python - Flask get 'next' parameters for a 'POST' request -
is a login function that accepts data from POST request but in this case the "next" query parameter is ignored . request.args
??
(): User = check_login (email = '' / 'login', methods = ['GET' '' POST '], endpoint =' login 'request.form [' email '], password = request.form [' password ']) If the user: login_user (user) redirect (request.args.get (' next ') or url_for (' index ')) Other: # returned some more render_template (' login.html ', form = form)
Thanks in advance.
You need to use:
A combined multidich form And with the content of ARG both.
In this way, no matter where your next
was set, you would be able to retrieve it:
@route ('/ login /', methods = ['GET' 'post'], endpoint = 'login') dig login (auto): redirect_url = request.values.get ('next', url_for (' Index '))
Comments
Post a Comment