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

@@ -12,6 +12,7 @@ from netbox.models import ChangeLoggedModel
from utilities.fields import ColorField, NaturalOrderingField
from utilities.mptt import TreeManager
from utilities.ordering import naturalize_interface
from utilities.tracking import TrackingModelMixin
from .device_components import (
ConsolePort, ConsoleServerPort, DeviceBay, FrontPort, Interface, InventoryItem, ModuleBay, PowerOutlet, PowerPort,
RearPort,
@@ -32,7 +33,7 @@ __all__ = (
)
class ComponentTemplateModel(ChangeLoggedModel):
class ComponentTemplateModel(ChangeLoggedModel, TrackingModelMixin):
device_type = models.ForeignKey(
to='dcim.DeviceType',
on_delete=models.CASCADE,