简体   繁体   English

#登录Django后如何传递URL参数

[英]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 如果我发送链接到URL中包含#args的Django页面,例如

http://localhost/someurl/?arg1=true&arg2=false#1970-01-01/2038-01-01/something_else 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 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 我还想保留的还是#1970-01-01 / 2038-01-01 / something_else

How can I do that in Django? 如何在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 ). 我将尝试修改负责生成链接的代码,以将#符号替换为%23 (即,其百分比编码: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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