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

Closes #13269: Cache component template counts on device types

This commit is contained in:
Jeremy Stretch
2023-07-25 16:17:58 -04:00
parent daa8f71bb6
commit 5b5444f414
9 changed files with 233 additions and 26 deletions

View File

@@ -32,8 +32,16 @@ def recalculate_device_counts(apps, schema_editor):
device.inventory_item_count = device._inventory_item_count
Device.objects.bulk_update(devices, [
'console_port_count', 'console_server_port_count', 'power_port_count', 'power_outlet_count', 'interface_count',
'front_port_count', 'rear_port_count', 'device_bay_count', 'module_bay_count', 'inventory_item_count',
'console_port_count',
'console_server_port_count',
'power_port_count',
'power_outlet_count',
'interface_count',
'front_port_count',
'rear_port_count',
'device_bay_count',
'module_bay_count',
'inventory_item_count',
])