mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 10:28:37 -06:00
Don't try to reapply ordering if ordering is already present
This commit is contained in:
parent
8c820924fb
commit
75c726e86d
@ -67,5 +67,8 @@ def reapply_model_ordering(queryset: QuerySet) -> QuerySet:
|
|||||||
# MPTT-based models are exempt from this; use caution when annotating querysets of these models
|
# MPTT-based models are exempt from this; use caution when annotating querysets of these models
|
||||||
if any(isinstance(manager, TreeManager) for manager in queryset.model._meta.local_managers):
|
if any(isinstance(manager, TreeManager) for manager in queryset.model._meta.local_managers):
|
||||||
return queryset
|
return queryset
|
||||||
|
elif queryset.ordered:
|
||||||
|
return queryset
|
||||||
|
|
||||||
ordering = queryset.model._meta.ordering
|
ordering = queryset.model._meta.ordering
|
||||||
return queryset.order_by(*ordering)
|
return queryset.order_by(*ordering)
|
||||||
|
Loading…
Reference in New Issue
Block a user