mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 17:26:10 -06:00
12118 only pass instance_map if from_template set
This commit is contained in:
parent
b4622bfd1a
commit
7320c88b56
@ -777,10 +777,12 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
to the newly created instances.
|
to the newly created instances.
|
||||||
"""
|
"""
|
||||||
instance_map = None
|
instance_map = None
|
||||||
|
kwargs = {'device': self}
|
||||||
if from_template:
|
if from_template:
|
||||||
instance_map = {}
|
kwargs['instance_map'] = {}
|
||||||
|
|
||||||
|
components = [obj.instantiate(**kwargs) for obj in queryset]
|
||||||
|
|
||||||
components = [obj.instantiate(device=self, instance_map=instance_map) for obj in queryset]
|
|
||||||
if components and bulk_create:
|
if components and bulk_create:
|
||||||
model = components[0]._meta.model
|
model = components[0]._meta.model
|
||||||
model.objects.bulk_create(components)
|
model.objects.bulk_create(components)
|
||||||
|
Loading…
Reference in New Issue
Block a user