Create hyperlink in django template of object that has a space

Posted by Ed on Stack Overflow See other posts from Stack Overflow or by Ed
Published on 2010-03-17T22:30:19Z Indexed on 2010/03/17 22:31 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

I am trying to create a dynamic hyperlink that depends on a value passed from a function:

{% for item in field_list %}
    <a href={% url index_view %}{{ item }}/> {{ item }} </a> <br>
{% endfor %}

The problem is that one of the items in field_list is "Hockey Player". The link for some reason is dropping everything after the space, so it creates the hyperlink on the entire "Hockey Player", but the address is

http://126.0.0.1:8000/Hockey

How can I get it to go to

http://126.0.0.1:8000/Hockey Player/

instead?

© Stack Overflow or respective owner

Related posts about django

Related posts about templates