简体   繁体   中英

How to pass URL arguments after # sign in Django

If I send a link to a Django page which has #args in the URL, eg

http://localhost/someurl/?arg1=true&arg2=false#1970-01-01/2038-01-01/something_else

Then the person is not logged in - the login form appears. Unfortunately after successful login, it will redirect the person to:

http://localhost/someurl/?arg1=true&arg2=false

What I would like to keep somehow is also the #1970-01-01/2038-01-01/something_else

How can I do that in Django?

I would try modifying the code responsible for generating the link such that the # symbol is replaced by %23 (ie its percent encoding: https://en.wikipedia.org/wiki/Percent-encoding ).

The final URL would be:

http://localhost/someurl/?arg1=true&arg2=false%231970-01-01/2038-01-01/something_else

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM