mirror of
https://github.com/django/django.git
synced 2025-10-17 22:07:29 +00:00
Changed the (internal) way extra(select=.., select_params=...) handling is done
so that parameters stay with their select items. This means that merging and trimming of those items is handled correctly. Refs #7957, #7961. Fixed #8191. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c92b424e57
commit
2c4b13cbe7
3 changed files with 60 additions and 16 deletions
|
@ -1014,6 +1014,12 @@ of the arguments is required, but you should use at least one of them.
|
|||
select=SortedDict(('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.
|
||||
|
||||
``where`` / ``tables``
|
||||
You can define explicit SQL ``WHERE`` clauses -- perhaps to perform
|
||||
non-explicit joins -- by using ``where``. You can manually add tables to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue