URL encoding on Django Template

django, django-templates, html, url-encoding

Solution

Instead of

{{ title }}

do

{{title|urlencode}}

Problem

I have this anchor link: ``` <a href="/question/tag/1/1/?list_id={{title}}">{{title}}</a> ``` Sometimes, this title has some content with + (add operator) like: "Django + Python" But when it is directly placed on anchor links, the url delivered will be: ``` http://127.0.0.1:8080/question/tag/1/1/?list_id=Django + Python ``` Which will eventually cause problem on the retrieval as the url decoder thought the list_id GET = DjangoPython. So, does anyone knows how to avoid this issue? Note that I do not want to change anchor links to input buttons.

Original source