File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,6 +229,9 @@ def write_export_file(
229229 concepts_qs = Concept .sources .through .objects .filter (source_id = version .id )
230230 mappings_qs = Mapping .sources .through .objects .filter (source_id = version .id )
231231
232+ concept_id_field = 'concept_id' if hasattr (concepts_qs .model , 'concept_id' ) else 'id'
233+ mapping_id_field = 'mapping_id' if hasattr (mappings_qs .model , 'mapping_id' ) else 'id'
234+
232235 filters = {}
233236
234237 if not is_collection :
@@ -246,7 +249,9 @@ def write_export_file(
246249 start = 0
247250 while True :
248251 batch_ids = list (
249- concepts_qs .order_by ('-concept_id' )[start :start + batch_size ].values_list ('concept_id' , flat = True )
252+ concepts_qs .order_by (f'-{ concept_id_field } ' )[start :start + batch_size ].values_list (
253+ concept_id_field , flat = True
254+ )
250255 )
251256 if not batch_ids :
252257 break
@@ -296,7 +301,9 @@ def write_export_file(
296301 start = 0
297302 while True :
298303 batch_ids = list (
299- mappings_qs .order_by ('-mapping_id' )[start :start + batch_size ].values_list ('mapping_id' , flat = True )
304+ mappings_qs .order_by (f'-{ mapping_id_field } ' )[start :start + batch_size ].values_list (
305+ mapping_id_field , flat = True
306+ )
300307 )
301308 if not batch_ids :
302309 break
You can’t perform that action at this time.
0 commit comments