best_filters.replace¶
-
best_filters.
replace
(str, arg)¶ Replace a substring
The replacement syntax is : <chosen separator><string to replace><separator><replacement string>
Examples
>>> c = {'mystr':'hello world'} >>> t = '{% load best_filters %}{{ mystr|replace:"/world/eric" }}' >>> Template(t).render(Context(c)) 'hello eric'
>>> c = {'mypath':'/home/theuser/projects'} >>> t = '{% load best_filters %}{{ mypath|replace:",/home,/Users" }}' >>> Template(t).render(Context(c)) '/Users/theuser/projects'