How to get parameters from current url

我的梦境 提交于 2020-03-02 09:39:08

问题


Is it possible to get an specific parameter in a url and use it in a template ?

`{{ request.path }}

It gets the whole url, i need only the 'pk' parameter, to make a link to another page.

Thanks.


回答1:


I did some experiments and find that this may help:

{{ request.resolver_match.kwargs.pk }}

For more info you can check this.



来源:https://stackoverflow.com/questions/40797746/how-to-get-parameters-from-current-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!