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: