[Fixed]-How to remove spaces from string in django template


From: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#cut


Removes all values of arg from the given string.

For example:

{{ value|cut:" " }}

If value is "String with spaces", the output will
be "Stringwithspaces".

This worked perfectly for what I wanted. Was not easy to find so creating this question to help the google juice for the next person.

So in my example it would be:

<a href="www.somesite.com/lookup?id={{ order.id|cut:" " }}"</a>

Leave a comment