mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 03:46:25 -06:00
Store default values from custom fields on newly created module components
This commit is contained in:
parent
9c7f2ec98c
commit
ca13500622
@ -1277,6 +1277,11 @@ class Module(PrimaryModel, ConfigContextModel):
|
|||||||
if not disable_replication:
|
if not disable_replication:
|
||||||
create_instances.append(template_instance)
|
create_instances.append(template_instance)
|
||||||
|
|
||||||
|
for component in create_instances:
|
||||||
|
# Set default values for any applicable custom fields
|
||||||
|
if cf_defaults := CustomField.objects.get_defaults_for_model(component_model):
|
||||||
|
component.custom_field_data = cf_defaults
|
||||||
|
|
||||||
if component_model is not ModuleBay:
|
if component_model is not ModuleBay:
|
||||||
component_model.objects.bulk_create(create_instances)
|
component_model.objects.bulk_create(create_instances)
|
||||||
# Emit the post_save signal for each newly created object
|
# Emit the post_save signal for each newly created object
|
||||||
|
Loading…
Reference in New Issue
Block a user