From 2c4b13cbe7477a7f94f11fa23e39033b005a3b88 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 17 Aug 2008 20:07:59 +0000 Subject: 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 --- docs/db-api.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs') diff --git a/docs/db-api.txt b/docs/db-api.txt index 3c97de3ca6..77a29cc8a5 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -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 -- cgit v1.3