I want to send GET request after handling POST in view. How can I do this? I tried return redirect('url_page')
but it sends POST on page
Technically, how a 302 response code is handled is up to the browser.
The server doesn’t have any real control over what the browser is going to do when it gets a 30X code as a response.
See Redirections in HTTP - HTTP | MDN
You’ve got a couple things I can think of that you could do to handle this more directly -
-
You could return something in the original request that’s going to get turned around and passed back to the server in the redirected request, allowing you to identify that this request is a result of being redirected from the previous page.
-
You could submit your form via JavaScript and handle the redirect response yourself.
Now, having said all this, I’ve never seen that happen before. In all cases I’ve ever worked with, a redirect following a form submittal has always resulted in a GET. I think there may be something else happening either in your view or in some JavaScript you may be running.
Thank you very much! It helped me to understand, that I had a mistake in views.py and I didn’t send redirect