Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.1.X] Fixed #12851 -- Corrected the interaction of defer() with sel…

…ect_related(). Thanks to ruosteinen for the report.

Backport of r12817 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4d00ac86eea3c4df7b11a9ca195ea69426e70f6a 1 parent eb1c7b0
Russell Keith-Magee authored March 20, 2010
2  django/db/models/query.py
@@ -996,7 +996,7 @@ def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0,
996 996
         else:
997 997
             next = None
998 998
         cached_row = get_cached_row(f.rel.to, row, index_end, max_depth,
999  
-                cur_depth+1, next)
  999
+                cur_depth+1, next, only_load=only_load)
1000 1000
         if cached_row:
1001 1001
             rel_obj, index_end = cached_row
1002 1002
             if obj is not None:
2  tests/regressiontests/defer_regress/models.py
@@ -143,7 +143,7 @@ def __unicode__(self):
143 143
 [<class 'regressiontests.defer_regress.models.Item'>, <class 'regressiontests.defer_regress.models.RelatedItem'>, <class 'regressiontests.defer_regress.models.Child'>, <class 'regressiontests.defer_regress.models.Leaf'>]
144 144
 
145 145
 >>> sorted(get_models(models.get_app('defer_regress'), include_deferred=True), key=lambda obj: obj._meta.object_name)
146  
-[<class 'regressiontests.defer_regress.models.Child'>, <class 'regressiontests.defer_regress.models.Item'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name_other_value_text'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name_other_value_value'>, <class 'regressiontests.defer_regress.models.Item_Deferred_other_value_text_value'>, <class 'regressiontests.defer_regress.models.Item_Deferred_text_value'>, <class 'regressiontests.defer_regress.models.Leaf'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_child_id_second_child_id_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_name_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_second_child_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_value'>, <class 'regressiontests.defer_regress.models.RelatedItem'>, <class 'regressiontests.defer_regress.models.RelatedItem_Deferred_'>, <class 'regressiontests.defer_regress.models.RelatedItem_Deferred_item_id'>]
  146
+[<class 'regressiontests.defer_regress.models.Child'>, <class 'regressiontests.defer_regress.models.Child_Deferred_value'>, <class 'regressiontests.defer_regress.models.Item'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name_other_value_text'>, <class 'regressiontests.defer_regress.models.Item_Deferred_name_other_value_value'>, <class 'regressiontests.defer_regress.models.Item_Deferred_other_value_text_value'>, <class 'regressiontests.defer_regress.models.Item_Deferred_text_value'>, <class 'regressiontests.defer_regress.models.Leaf'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_child_id_second_child_id_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_name_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_second_child_value'>, <class 'regressiontests.defer_regress.models.Leaf_Deferred_value'>, <class 'regressiontests.defer_regress.models.RelatedItem'>, <class 'regressiontests.defer_regress.models.RelatedItem_Deferred_'>, <class 'regressiontests.defer_regress.models.RelatedItem_Deferred_item_id'>]
147 147
 """
148 148
 }
149 149
 
9  tests/regressiontests/select_related_regress/models.py
@@ -165,4 +165,13 @@ def __unicode__(self):

0 notes on commit 4d00ac8

Please sign in to comment.
Something went wrong with that request. Please try again.