diff options
| author | Nick Pope <nick.pope@flightdataservices.com> | 2019-02-05 11:22:08 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-02-06 13:48:39 -0500 |
| commit | 24b82cd201e21060fbc02117dc16d1702877a1f3 (patch) | |
| tree | 7d36db9251700d0abf8fbf69399c8abc7fd9026a /docs/ref | |
| parent | 21bb71ef0dcb86798edb0d8b21138bcc4b947590 (diff) | |
Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index d09618985f..2bd347701b 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1363,17 +1363,14 @@ of the arguments is required, but you should use at least one of them. In some rare cases, you might wish to pass parameters to the SQL fragments in ``extra(select=...)``. For this purpose, use the - ``select_params`` parameter. Since ``select_params`` is a sequence and - the ``select`` attribute is a dictionary, some care is required so that - the parameters are matched up correctly with the extra select pieces. - In this situation, you should use a :class:`collections.OrderedDict` for - the ``select`` value, not just a normal Python dictionary. + ``select_params`` parameter. This will work, for example:: Blog.objects.extra( - select=OrderedDict([('a', '%s'), ('b', '%s')]), - select_params=('one', 'two')) + select={'a': '%s', 'b': '%s'}, + select_params=('one', 'two'), + ) If you need to use a literal ``%s`` inside your select string, use the sequence ``%%s``. |
