Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get parameters from current url

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.

like image 593
Goun2 Avatar asked Oct 25 '25 14:10

Goun2


1 Answers

I did some experiments and find that this may help:

{{ request.resolver_match.kwargs.pk }}

For more info you can check this.

like image 132
shellbye Avatar answered Oct 27 '25 05:10

shellbye