@@ -163,12 +163,13 @@ def key_transform_is_null_expr(self, compiler, connection):
163
163
164
164
Reference: https://code.djangoproject.com/ticket/32252
165
165
"""
166
+ lhs_mql = process_lhs (self , compiler , connection )
167
+ rhs_mql = process_rhs (self , compiler , connection )
168
+ # Get the root column.
166
169
previous = self .lhs
167
170
while isinstance (previous , KeyTransform ):
168
171
previous = previous .lhs
169
172
root_column = previous .as_mql (compiler , connection )
170
- lhs_mql = process_lhs (self , compiler , connection , as_path = False )
171
- rhs_mql = process_rhs (self , compiler , connection , as_path = False )
172
173
return _has_key_predicate (lhs_mql , root_column , negated = rhs_mql )
173
174
174
175
@@ -186,8 +187,8 @@ def key_transform_numeric_lookup_mixin_expr(self, compiler, connection):
186
187
Return MQL to check if the field exists (i.e., is not "missing" or "null")
187
188
and that the field matches the given numeric lookup expression.
188
189
"""
189
- lhs = process_lhs (self , compiler , connection , as_path = False )
190
190
expr = builtin_lookup_expr (self , compiler , connection )
191
+ lhs = process_lhs (self , compiler , connection )
191
192
# Check if the type of lhs is not "missing" or "null".
192
193
not_missing_or_null = {"$not" : {"$in" : [{"$type" : lhs }, ["missing" , "null" ]]}}
193
194
return {"$and" : [expr , not_missing_or_null ]}
0 commit comments