diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 76d723e0eb..e62e2e3eaf 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -25,6 +25,8 @@ def stringfilter(func): if args: args = list(args) args[0] = force_unicode(args[0]) + if isinstance(args[0], SafeData) and getattr(func, 'is_safe', False): + return mark_safe(func(*args, **kwargs)) return func(*args, **kwargs) # Include a reference to the real function (used to check original