Add docstrings for get_queryset base class methods (#18832)

This commit is contained in:
bctiemann 2025-03-06 12:11:55 -05:00 committed by GitHub
parent 3ef7ab4416
commit f9c8d12a51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -122,6 +122,10 @@ class NetBoxModelViewSet(
return obj
def get_queryset(self):
"""
Reapply model-level ordering in case it has been lost through .annotate().
https://code.djangoproject.com/ticket/32811
"""
qs = super().get_queryset()
ordering = qs.model._meta.ordering
return qs.order_by(*ordering)

View File

@ -126,6 +126,10 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
#
def get_queryset(self, request):
"""
Reapply model-level ordering in case it has been lost through .annotate().
https://code.djangoproject.com/ticket/32811
"""
qs = super().get_queryset(request)
ordering = qs.model._meta.ordering
return qs.order_by(*ordering)