Ticket #16385: 0ad3af376503d32dab0adb8c9aaa57bd389ea0b2.diff

File 0ad3af376503d32dab0adb8c9aaa57bd389ea0b2.diff, 1.0 KB (added by jonash, 4 years ago)

Adds a supports_select_related flag

  • django/db/backends/__init__.py

    diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
    index 2dbf56f..4487bde 100644
    a b class BaseDatabaseFeatures(object): 
    281281    allow_sliced_subqueries = True
    282282
    283283    supports_joins = True
     284    supports_select_related = True
    284285
    285286    # Does the default test database allow multiple connections?
    286287    # Usually an indication that the test database is in-memory
  • django/db/models/query.py

    diff --git a/django/db/models/query.py b/django/db/models/query.py
    index 324554e..26402ba 100644
    a b class QuerySet(object): 
    216216        An iterator over the results from applying this QuerySet to the
    217217        database.
    218218        """
    219         fill_cache = self.query.select_related
     219        fill_cache = False
     220        if connections[self.db].features.supports_select_related:
     221            fill_cache = self.query.select_related
    220222        if isinstance(fill_cache, dict):
    221223            requested = fill_cache
    222224        else:
Back to Top