Fixes #20875: Fix updating of denormalized fields for component models (#20956)

This commit is contained in:
Arthur Hanson
2025-12-12 11:29:34 -08:00
committed by GitHub
parent 21f4036782
commit ec13a79907
3 changed files with 20 additions and 0 deletions

View File

@@ -315,6 +315,12 @@ class Module(PrimaryModel, ConfigContextModel):
for component in create_instances:
component.custom_field_data = cf_defaults
# Set denormalized references
for component in create_instances:
component._site = self.device.site
component._location = self.device.location
component._rack = self.device.rack
if component_model is not ModuleBay:
component_model.objects.bulk_create(create_instances)
# Emit the post_save signal for each newly created object