netbox-kea icon indicating copy to clipboard operation
netbox-kea copied to clipboard

add ordering to avoid exceptions in netbox > v4.4.0

Open tbotnz opened this issue 5 months ago • 4 comments

  • API paginator raises out when queryset is not ordered https://github.com/netbox-community/netbox/issues/18900

tbotnz avatar Sep 25 '25 03:09 tbotnz

Thanks for the fix. I haven't seen this error before. What causes it?

devon-mar avatar Sep 27 '25 19:09 devon-mar

This https://github.com/netbox-community/netbox/blob/main/netbox/netbox/api/pagination.py#L20-L23

it's set as the paginator class for DRF https://github.com/netbox-community/netbox/blob/main/netbox/netbox/settings.py#L703

so basically any DRF view that paginates needs to be ordered otherwise it'll raise out unless the pagination is overloaded in the view subclass

tbotnz avatar Sep 27 '25 20:09 tbotnz

*note this seems to have appeared in recent versions

tbotnz avatar Sep 27 '25 20:09 tbotnz

I see, maybe it wasn't caught by the existing API tests because there aren't many objects returned to invoke the paginator. Could you add a test? It should fail if this patch isn't applied.

devon-mar avatar Sep 27 '25 22:09 devon-mar