machomeautoguy
machomeautoguy

Reputation: 619

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?

Upvotes: 3

Views: 5249

Answers (1)

Wessel Badenhorst
Wessel Badenhorst

Reputation: 15

"/" 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.

Upvotes: 1

Related Questions