File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -151,24 +151,25 @@ def get_transform(self, name):
151151 new_field = opts .get_field (name )
152152 result = KeyTransformFactory (name , new_field )
153153 else :
154- if self .ref_field is not None and self . ref_field .get_transform (name ) is None :
154+ if self .ref_field .get_transform (name ) is None :
155155 raise FieldDoesNotExist (
156156 f"{ self .ref_field .model ._meta .object_name } has no field named '{ name } '"
157157 )
158- result = KeyTransformFactory (name , None )
158+ result = KeyTransformFactory (name , self . ref_field )
159159 return result
160160
161161 def preprocess_lhs (self , compiler , connection ):
162162 previous = self
163163 embedded_key_transforms = []
164164 json_key_transforms = []
165165 while isinstance (previous , KeyTransform ):
166- if previous .ref_field is not None :
166+ if isinstance ( previous .ref_field , EmbeddedModelField ) :
167167 embedded_key_transforms .insert (0 , previous .key_name )
168168 else :
169169 json_key_transforms .insert (0 , previous .key_name )
170170 previous = previous .lhs
171171 mql = previous .as_mql (compiler , connection )
172+ embedded_key_transforms .append (json_key_transforms .pop (0 ))
172173 return mql , embedded_key_transforms , json_key_transforms
173174
174175
You can’t perform that action at this time.
0 commit comments