mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[1.10.x] Fixed #25475 -- Doc'd how to use a literal % in Func.template.
Backport of c60feb6999 from master
This commit is contained in:
@@ -263,6 +263,12 @@ The ``Func`` API is as follows:
|
|||||||
generated for this function. Defaults to
|
generated for this function. Defaults to
|
||||||
``'%(function)s(%(expressions)s)'``.
|
``'%(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
|
.. attribute:: arg_joiner
|
||||||
|
|
||||||
A class attribute that denotes the character used to join the list of
|
A class attribute that denotes the character used to join the list of
|
||||||
|
|||||||
Reference in New Issue
Block a user