diff --git a/netbox/dcim/migrations/0174_remove_inventoryitem_level_remove_inventoryitem_lft_and_more.py b/netbox/dcim/migrations/0174_remove_inventoryitem_level_remove_inventoryitem_lft_and_more.py index 3052bddf6..c1f9c4bc2 100644 --- a/netbox/dcim/migrations/0174_remove_inventoryitem_level_remove_inventoryitem_lft_and_more.py +++ b/netbox/dcim/migrations/0174_remove_inventoryitem_level_remove_inventoryitem_lft_and_more.py @@ -145,4 +145,8 @@ class Migration(migrations.Migration): to='dcim.sitegroup', ), ), + migrations.AlterModelOptions( + name='inventoryitem', + options={'ordering': ('_name',)}, + ), ] diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index f14c3018f..51d10542e 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -1128,7 +1128,8 @@ class InventoryItem(TreeNode, ComponentModel): clone_fields = ('device', 'parent', 'role', 'manufacturer', 'part_id',) class Meta: - ordering = ('device__id', 'parent__id', '_name') + # ordering = ('device__id', 'parent__id', '_name') + ordering = ('_name', ) constraints = ( models.UniqueConstraint( fields=('device', 'parent', 'name'),