diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2011-12-05 23:11:43 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2011-12-05 23:11:43 +0000 |
| commit | 5f9dbef4bb5d8b9f077cd6a01b5e554f6dfb4f19 (patch) | |
| tree | 4e5df16cbe88c291aedb642e0ed0cdca62f1e45d | |
| parent | 33bb3cd47cb287daa1246b705eff0f55bf72d284 (diff) | |
Fixed #17335 -- Added supports_select_related hook for django-nonrel. Thanks, jonash
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17170 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/backends/__init__.py | 2 | ||||
| -rw-r--r-- | django/db/models/query.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index dd248787e2..f2bde840d7 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -313,6 +313,8 @@ class BaseDatabaseFeatures(object): has_select_for_update = False has_select_for_update_nowait = False + supports_select_related = True + # Does the default test database allow multiple connections? # Usually an indication that the test database is in-memory test_db_allows_multiple_connections = True diff --git a/django/db/models/query.py b/django/db/models/query.py index 80cdefd22e..1b8636276a 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -232,7 +232,9 @@ class QuerySet(object): An iterator over the results from applying this QuerySet to the database. """ - fill_cache = self.query.select_related + fill_cache = False + if connections[self.db].features.supports_select_related: + fill_cache = self.query.select_related if isinstance(fill_cache, dict): requested = fill_cache else: |
