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 4 years, 10 months ago
- Cheap direct_to_tempalte patterns by jjdelc 4 years, 6 months ago
- keywords arguments parser for custom template tags by bruno 4 years, 4 months ago
- Login Required Middleware by onecreativenerd 4 years, 6 months ago
- Login Required Middleware with Next Parameter by bernardoporto 6 months, 1 week ago
Comments