Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django urlencode template filter

I'm attempting to URL encode a string that contains slashes in Django 1.3 using the optional argument shown in the docs:

{{ someString|urlencode:"" }}

However, the slashes aren't getting URL encoded, they're left intact. So, if someString is "A/V Equipment", I'm getting "A/V%20Equipment". What am I doing wrong?

like image 572
machomeautoguy Avatar asked Apr 11 '26 03:04

machomeautoguy


1 Answers

"/" is already a valid url character and as such will not be encoded to something else. You are not doing anything wrong. I take it you are having issues with some sort of clean url argument that gets confused with the / character? If this is the case, rather pass the string in as a query parameter.

like image 101
Wessel Badenhorst Avatar answered Apr 12 '26 17:04

Wessel Badenhorst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!