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

Fixes #9007: Fix FieldError exception when instantiating a device type with nested inventory items

This commit is contained in:
jeremystretch
2022-03-31 12:07:02 -04:00
parent 1d55c04c21
commit 4fae42de51
2 changed files with 2 additions and 1 deletions

View File

@@ -551,7 +551,7 @@ class InventoryItemTemplate(MPTTModel, ComponentTemplateModel):
unique_together = ('device_type', 'parent', 'name')
def instantiate(self, **kwargs):
parent = InventoryItemTemplate.objects.get(name=self.parent.name, **kwargs) if self.parent else None
parent = InventoryItem.objects.get(name=self.parent.name, **kwargs) if self.parent else None
if self.component:
model = self.component.component_model
component = model.objects.get(name=self.component.name, **kwargs)