I have a Sign Up page which takes a user's username and password and saves it in the database. If the user is successfully signed up, I want to redirect him to a 'Sign In' page, with a value denoting that Signup was successful.
Expected output on the redirected page:
You have been successfully signed up.
Sign In
Username: ---
Password: ---
So, I am redirecting from the signup to the signin page, but I want to pass a value showing that the user has come from the Signup page and is successfully signed up.
How do I perform this?
Use the messages framework to add a message in the first view and display it in the second one.
Or simply put an item in the session, and pop it out again:
request.session['signup'] = True
return redirect('wherever')
...
signup = request.session.pop('signup', False)
if signup:
... do something ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With