diff options
| author | Matt Robenolt <matt@ydekproductions.com> | 2014-09-10 07:23:58 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-09-26 13:01:27 -0400 |
| commit | ef5f9b6ae8c873927aa6047f5f9d1d902a0c2177 (patch) | |
| tree | b770d3bdbafbbce0c62bbc67ac9da7e1f80c4ff9 /docs | |
| parent | 17557d068c43bd61cdc6c18caf250ffa469414a1 (diff) | |
Fixed #23460 -- Added literal `%s` support to extra() QuerySets.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 11 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 294eeb6ef5..c7d3bf6b90 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1144,11 +1144,12 @@ of the arguments is required, but you should use at least one of them. select=OrderedDict([('a', '%s'), ('b', '%s')]), select_params=('one', 'two')) - The only thing to be careful about when using select parameters in - ``extra()`` is to avoid using the substring ``"%%s"`` (that's *two* - percent characters before the ``s``) in the select strings. Django's - tracking of parameters looks for ``%s`` and an escaped ``%`` character - like this isn't detected. That will lead to incorrect results. + If you need to use a literal ``%s`` inside your select string, use + the sequence ``%%s``. + + .. versionchanged:: 1.8 + + Prior to 1.8, you were unable to escape a literal ``%s``. * ``where`` / ``tables`` diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index c77b40a6a3..15fe657d4b 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -281,6 +281,9 @@ Models Django uses whenever objects are loaded using the ORM. The method allows customizing model loading behavior. +* ``extra(select={...})`` now allows you to escape a literal ``%s`` sequence + using ``%%s``. + Signals ^^^^^^^ |
