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 c1f9c4bc2..fb3417816 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 @@ -149,4 +149,12 @@ class Migration(migrations.Migration): name='inventoryitem', options={'ordering': ('_name',)}, ), + migrations.AlterModelOptions( + name='inventoryitemtemplate', + options={'ordering': ('_name',)}, + ), + migrations.AlterModelOptions( + name='location', + options={'ordering': ('name',)}, + ), ] diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py index a36400fcb..c6f629507 100644 --- a/netbox/dcim/models/device_component_templates.py +++ b/netbox/dcim/models/device_component_templates.py @@ -663,7 +663,7 @@ class InventoryItemTemplate(TreeNode, ComponentTemplateModel): component_model = InventoryItem class Meta: - ordering = ('device_type__id', 'parent__id', '_name') + ordering = ('_name', ) constraints = ( models.UniqueConstraint( fields=('device_type', 'parent', 'name'), diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 51d10542e..938aa731c 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -1128,7 +1128,6 @@ class InventoryItem(TreeNode, ComponentModel): clone_fields = ('device', 'parent', 'role', 'manufacturer', 'part_id',) class Meta: - # ordering = ('device__id', 'parent__id', '_name') ordering = ('_name', ) constraints = ( models.UniqueConstraint( diff --git a/netbox/dcim/models/sites.py b/netbox/dcim/models/sites.py index 43c47a359..8a2e732d9 100644 --- a/netbox/dcim/models/sites.py +++ b/netbox/dcim/models/sites.py @@ -294,7 +294,7 @@ class Location(NestedGroupModel): ) class Meta: - ordering = ['site', 'name'] + ordering = ('name', ) constraints = ( models.UniqueConstraint( fields=('site', 'parent', 'name'), diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index a0238a1fb..7f0c25005 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -857,7 +857,7 @@ class InventoryItemTable(DeviceComponentTable): class DeviceInventoryItemTable(InventoryItemTable): name = tables.TemplateColumn( - template_code='' + template_code='' '{{ value }}', order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html index 697737ceb..afc387e7f 100644 --- a/netbox/templates/dcim/site.html +++ b/netbox/templates/dcim/site.html @@ -145,7 +145,7 @@ {% for location in locations %}