فهرست منبع

Fixes #3127: Fix natural ordering of device components

Jeremy Stretch 6 سال پیش
والد
کامیت
5a8ba159f2
2فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 8 0
      CHANGELOG.md
  2. 4 0
      netbox/utilities/managers.py

+ 8 - 0
CHANGELOG.md

@@ -1,3 +1,11 @@
+2.5.12 (2019-04-30)
+
+## Bug Fixes
+
+* [#3127](https://github.com/digitalocean/netbox/issues/3127) - Fix natural ordering of device components
+
+---
+
 2.5.11 (2019-04-29)
 
 ## Notes

+ 4 - 0
netbox/utilities/managers.py

@@ -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)