From 93d1fdb1304ed5b2e5ea2e0f1e84db7fff5eb7fa Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Mon, 9 Apr 2012 00:43:08 +0000 Subject: Fixed #17877 -- Ensured that extra WHERE clauses get correctly ANDed when they contain OR operations. Thanks to Marek Brzóska for the report, to eleather for the test case and to Adrien Lemaire for the patch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@17880 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/models/querysets.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index e25bea0e69..b20c6e34e5 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -968,11 +968,11 @@ of the arguments is required, but you should use at least one of them. Example:: - Entry.objects.extra(where=['id IN (3, 4, 5, 20)']) + Entry.objects.extra(where=["foo='a' OR bar = 'a'", "baz = 'a'"]) ...translates (roughly) into the following SQL:: - SELECT * FROM blog_entry WHERE id IN (3, 4, 5, 20); + SELECT * FROM blog_entry WHERE (foo='a' OR bar='a') AND (baz='a') Be careful when using the ``tables`` parameter if you're specifying tables that are already used in the query. When you add extra tables -- cgit v1.3