1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #3127: Fix natural ordering of device components

This commit is contained in:
Jeremy Stretch
2019-04-30 13:25:37 -04:00
parent 7b5c1964b9
commit 5a8ba159f2
2 changed files with 12 additions and 0 deletions

View File

@@ -37,4 +37,8 @@ class NaturalOrderingManager(Manager):
else:
ordering.append(field)
# Default to using the _nat indexes if Meta.ordering is empty
if not ordering:
ordering = ('_nat1', '_nat2', '_nat3')
return queryset.order_by(*ordering)