Hay, I'm writing some templates but i want to convert " " into "_" within a string.
I want to convert
{{ user.name }}
Which outputs "My Name"
to "My_Name"
how do i do this?
Thanks
Hay, I'm writing some templates but i want to convert " " into "_" within a string.
I want to convert
{{ user.name }}
Which outputs "My Name"
to "My_Name"
how do i do this?
Thanks
There is no built-in tag or filter to do this replacement. Write a filter that splits by a given character, and then combine that with the join
filter, or write a filter that does the replacement directly.