The problem is when I try to use django.shortcuts.redirect
in my view function, Django doesn't simply opening new url path from return redirect('url',)
but add wished url path to current url.
Example
Current url is: /home/page1
On page on button press I call views function which: return redirect ('**/home/page2**',)
After this, instead wished url /home/page2 I recieve /home/page1/home/page2
How to get rid of old url part from redirection?
EDIT:
Solved by deleting cookies and search history from browser (Chrome), and code work perfectly fine!
In the comments you have:
return redirect ('home/page2',)
This is incorrect. The url must start with a slash, otherwise it will be treated as a relative url. Change it to:
return redirect ('/home/page2')
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