开发者

django urlencode multiple variables in template

开发者 https://www.devze.com 2023-01-21 22:24 出处:网络
I want to url encode the following inside template {{address.street}} {{address.city}} {address.state}}

I want to url encode the following inside template

{{address.street}} {{address.city}} {address.state}}

is there anyway to do this on the template side and place it int开发者_开发问答o an href( i prefer NOT to combine them on the server side):

<a href="http://maps.google.com/maps?daddr=<!-- OVER HERE --!>">Map It</a>

thanks!


<a href="http://maps.google.com/maps?daddr={{address.street|urlencode}} {{address.city|urlencode}} {{address.state|urlencode}}">

I'm not sure how you wanted to combine them, I just used a space. Or:

<a href="http://maps.google.com/maps?daddr={% filter urlencode %}{{address.street}} {{address.city}} {{address.state}}{% endfilter %}">
0

精彩评论

暂无评论...
验证码 换一张
取 消