From a1842e3299daf3bde0ab5d418c912a265e7479c9 Mon Sep 17 00:00:00 2001 From: Preston Timmons Date: Thu, 2 Apr 2015 22:29:23 -0500 Subject: [PATCH] Updated docstring for firstof tag to reflect new auto-escaping behavior. --- django/template/defaulttags.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index e8e83ed46e..6c0bf60094 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -767,11 +767,15 @@ def firstof(parser, token): {% firstof var1 var2 var3 "fallback value" %} - If you want to escape the output, use a filter tag:: + If you want to disable auto-escaping of variables you can use:: - {% filter force_escape %} - {% firstof var1 var2 var3 "fallback value" %} - {% endfilter %} + {% autoescape off %} + {% firstof var1 var2 var3 "fallback value" %} + {% autoescape %} + + Or if only some variables should be escaped, you can use:: + + {% firstof var1 var2|safe var3 "fallback value"|safe %} """ bits = token.split_contents()[1:]