emraldinho
emraldinho

Reputation: 497

Flask Redirect with parameter

Ideally I would like to return this, but it doesn't work:

return redirect(url_for('register'), message='email already exists')

I've tried this version without the url_for:

return redirect('register.html', message='email already exists')

does not work either. Do you have to return the message explicitly in the url or save it in a cookie? Is there not a cleaner way to do it?

Thank you for help

Upvotes: 0

Views: 5800

Answers (1)

Leandro Poblet
Leandro Poblet

Reputation: 1464

According to the official docs, the parameters should be pass in the url_for, not the redirect.

return redirect(url_for('register', message='email already exists'))

Upvotes: 3

Related Questions