request.build_absolute_uri()返回我url/path/?q1=v1&q2=v2...但是,我需要没有查询参数的相同绝对 uriq1=v1&q2=v2
该build_absolute_uri方法有一个可选的location. 如果没有location提供,则使用get_full_path()包含查询字符串的内容。您可以传递request.path(不包括查询字符串)作为位置。
request.build_absolute_uri(request.path)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2209 次 |
| 最近记录: |