@@ -392,16 +392,16 @@ def get_param(self, *names: str) -> str:
392392 return self ._params [name ]
393393 return ''
394394
395- def get_sort_field_info (self , * args : str ) -> tuple [str , bool ]| None :
395+ def get_sort_field_info (self , * args : str ) -> tuple [str , bool ] | None :
396396 """
397397 Returns sorting information for the first sorting if it is contained in the odata orderby list.
398398
399399 Args:
400400 args: The possible name of the field name to check for sorting information.
401-
401+
402402 Returns:
403403 A tuple containing the clean field name found and a boolean indicating if the sorting is descending,
404-
404+
405405 Note:
406406 We only use the first in case of table sort translations, so this only returns info for the first field
407407 """
@@ -413,7 +413,7 @@ def get_sort_field_info(self, *args: str) -> tuple[str, bool]|None:
413413 is_descending = order_field .startswith ('-' )
414414 return (clean_field , is_descending )
415415 return None
416-
416+
417417 def apply_sort (self , qs : QuerySet [typing .Any ]) -> list [typing .Any ] | QuerySet [typing .Any ]:
418418 """
419419 Custom sorting function to apply to querysets.
@@ -452,7 +452,7 @@ def filter_odata_queryset(self, qs: QuerySet[typing.Any]) -> list[typing.Any]:
452452 result = self .apply_sort (qs )
453453 else :
454454 result = qs
455-
455+
456456 # If odata start/limit are set, apply them
457457 if self .odata .start is not None :
458458 result = result [self .odata .start :]
@@ -464,13 +464,6 @@ def filter_odata_queryset(self, qs: QuerySet[typing.Any]) -> list[typing.Any]:
464464 # to avoid issues later
465465 result = list (result )
466466
467- # Get total items and set it on X-Filtered-Count
468- try :
469- total_items = len (result )
470- self .add_header ('X-Filtered-Count' , total_items )
471- except Exception as e :
472- raise exceptions .rest .RequestError (f'Invalid odata: { e } ' )
473-
474467 return result
475468
476469 def filter_odata_data (self , data : collections .abc .Iterable [T ]) -> list [T ]:
0 commit comments