summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-10-07 10:24:45 -0400
committerTim Graham <timograham@gmail.com>2016-10-07 10:25:07 -0400
commitbe535960b1b877da50c2b66301820f68e312463c (patch)
treeb911ab9c45e52a58b9f7cc4b38aaf1449d4880ff /docs/ref
parent08650ab7417db1bb0d509b70335bae2dfab5a1b6 (diff)
[1.10.x] Fixed #25475 -- Doc'd how to use a literal % in Func.template.
Backport of c60feb6999f83bfd1fdabff01f0dd4a26d72e158 from master
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/expressions.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt
index 1b199c1df6..1038e886bb 100644
--- a/docs/ref/models/expressions.txt
+++ b/docs/ref/models/expressions.txt
@@ -263,6 +263,12 @@ The ``Func`` API is as follows:
generated for this function. Defaults to
``'%(function)s(%(expressions)s)'``.
+ If you're constructing SQL like ``strftime('%W', 'date')`` and need a
+ literal ``%`` character in the query, quadruple it (``%%%%``) in the
+ ``template`` attribute because the string is interpolated twice: once
+ during the template interpolation in ``as_sql()`` and once in the SQL
+ interpolation with the query parameters in the database cursor.
+
.. attribute:: arg_joiner
A class attribute that denotes the character used to join the list of