1 2 3 4 5 6 7 8 9 10 11 | import re
from django import template
register = template.Library()
@register.filter
def replace ( string, args ):
search = args.split(args[0])[1]
replace = args.split(args[0])[2]
return re.sub( search, replace, string )
|
More like this
- @reply links in Twitter messages by ryanberg 3 years, 7 months ago
- Template tag "ifregex" and "ifnotregex" by arthurfurlan 2 years, 8 months ago
- Cheap direct_to_tempalte patterns by jjdelc 3 years, 2 months ago
- Use MEDIA_URL in flatpages by robhudson 3 years, 10 months ago
- in_group template filter by whiteinge 3 years, 7 months ago
Comments