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

Initial work on #8118

This commit is contained in:
jeremystretch
2021-12-29 15:02:25 -05:00
parent 3bb485d0b8
commit 4c15f4a84f
21 changed files with 712 additions and 32 deletions

View File

@@ -933,6 +933,9 @@ class Device(PrimaryModel, ConfigContextModel):
DeviceBay.objects.bulk_create(
[x.instantiate(device=self) for x in self.device_type.devicebaytemplates.all()]
)
# Avoid bulk_create to handle MPTT
for x in self.device_type.inventoryitemtemplates.all():
x.instantiate(device=self).save()
# Update Site and Rack assignment for any child Devices
devices = Device.objects.filter(parent_bay__device=self)