urlencode in app engine templates

70 views
Skip to first unread message

Remis B

unread,
Jan 1, 2009, 5:54:00 AM1/1/09
to Google App Engine
Hi Everyone

I need to url encode an string in the template. In django template
language reference I saw documentation for filter "URLENCODE" which
"Escapes a value for use in a URL". When I tried it, it does nothing,
I'm getting back the same string. I want to produce an url with
properly encoded url string, such as "<a href="/catalog/feature/Full
+HD1080p">Full HD1080p</a>" where space and other characters are
encoded in url safe form.

I've tried this syntax in my template file

<a href="/catalog/feature/{{ feature.code|urlencode }}">
{{ feature.code }}</a>


Just wondering what I'm doing wrong.

Thanks in advance.

Remis B

ctran

unread,
Jan 2, 2009, 1:34:33 PM1/2/09
to Google App Engine
Look at the source instead of what the browser tells you: you'll see
that is encoded (with %20)
Reply all
Reply to author
Forward
0 new messages