File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ def queryset(self):
109
109
query = CTEQuery (cte_query .model )
110
110
query .join (BaseTable (self .name , None ))
111
111
query .default_cols = cte_query .default_cols
112
+ query .deferred_loading = cte_query .deferred_loading
112
113
if cte_query .annotations :
113
114
for alias , value in cte_query .annotations .items ():
114
115
col = CTEColumnRef (alias , self .name , value .output_field )
Original file line number Diff line number Diff line change @@ -104,3 +104,12 @@ def test_cte_queryset_with_custom_queryset(self):
104
104
('venus' , 22 , 'sun' ),
105
105
('venus' , 23 , 'sun' ),
106
106
])
107
+
108
+ def test_cte_queryset_with_deferred_loading (self ):
109
+ cte = With (
110
+ OrderCustomManagerNQuery .objects .order_by ("id" ).only ("id" )[:1 ]
111
+ )
112
+ orders = cte .queryset ().with_cte (cte )
113
+ print (orders .query )
114
+
115
+ self .assertEqual ([x .id for x in orders ], [1 ])
You can’t perform that action at this time.
0 commit comments