From eee4f00bfbaf05d08d194276115ed7a24434ee9a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 3 Feb 2006 23:30:56 +0000 Subject: [PATCH] magic-removal: Improved QOperator.get_sql() to NOT output parenthesis in where clause if there is no where clause git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2257 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index fa3969ecfc..df748b0a45 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -451,7 +451,9 @@ class QOperator: joins.update(joins2) where.extend(where2) params.extend(params2) - return tables, joins, ['(%s)' % self.operator.join(where)], params + if where: + return tables, joins, ['(%s)' % self.operator.join(where)], params + return tables, joins, [], params class QAnd(QOperator): "Encapsulates a combined query that uses 'AND'."