Ticket #17335: supports-select-related.patch

File supports-select-related.patch, 1.3 KB (added by Jonas H., 12 years ago)
  • django/db/backends/__init__.py

    commit 893caaaad91dee42e6bd717f3745f60a9c89def7
    Author: Jonas Haag <jonas@lophus.org>
    Date:   Wed Sep 28 21:42:54 2011 +0200
    
        supports_select_related
    
    diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
    index dd24878..f2bde84 100644
    a b class BaseDatabaseFeatures(object):  
    313313    has_select_for_update = False
    314314    has_select_for_update_nowait = False
    315315
     316    supports_select_related = True
     317
    316318    # Does the default test database allow multiple connections?
    317319    # Usually an indication that the test database is in-memory
    318320    test_db_allows_multiple_connections = True
  • django/db/models/query.py

    diff --git a/django/db/models/query.py b/django/db/models/query.py
    index be42d02..3ac8be4 100644
    a b class QuerySet(object):  
    232232        An iterator over the results from applying this QuerySet to the
    233233        database.
    234234        """
    235         fill_cache = self.query.select_related
     235        fill_cache = False
     236        if connections[self.db].features.supports_select_related:
     237            fill_cache = self.query.select_related
    236238        if isinstance(fill_cache, dict):
    237239            requested = fill_cache
    238240        else:
Back to Top