diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-03-10 15:27:22 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-03-10 15:27:22 +0000 |
| commit | d312fa2a619633c45afd3cfdb90f325e2ecd9be9 (patch) | |
| tree | ca12a2525ba4829176371f5bc91a57b2981f945a /django/db | |
| parent | 2287426ba6d363e919f900027be907db3a30181e (diff) | |
Fixed #12717 -- Corrected a problem with subqueries when using multidb routing. Thanks to Jeff Balogh for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/models/query.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index fea1144200..5c7d08fb39 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -796,7 +796,7 @@ class QuerySet(object): Returns the internal query's SQL and parameters (as a tuple). """ obj = self.values("pk") - if connection == connections[obj.db]: + if obj._db is None or connection == connections[obj._db]: return obj.query.get_compiler(connection=connection).as_nested_sql() raise ValueError("Can't do subqueries with queries on different DBs.") @@ -918,7 +918,7 @@ class ValuesQuerySet(QuerySet): % self.__class__.__name__) obj = self._clone() - if connection == connections[obj.db]: + if obj._db is None or connection == connections[obj._db]: return obj.query.get_compiler(connection=connection).as_nested_sql() raise ValueError("Can't do subqueries with queries on different DBs.") |
