Fix replication of module bays on new modules

This commit is contained in:
Jeremy Stretch 2024-07-29 12:56:48 -04:00
parent 399a2d6ad5
commit a16ad7474b
2 changed files with 5 additions and 4 deletions

View File

@ -672,12 +672,12 @@ class ModuleBayTemplate(ModularComponentTemplateModel):
verbose_name = _('module bay template') verbose_name = _('module bay template')
verbose_name_plural = _('module bay templates') verbose_name_plural = _('module bay templates')
def instantiate(self, device): def instantiate(self, **kwargs):
return self.component_model( return self.component_model(
device=device,
name=self.name, name=self.name,
label=self.label, label=self.label,
position=self.position position=self.position,
**kwargs
) )
instantiate.do_not_call_in_templates = True instantiate.do_not_call_in_templates = True

View File

@ -1224,7 +1224,8 @@ class Module(PrimaryModel, ConfigContextModel):
("powerporttemplates", "powerports", PowerPort), ("powerporttemplates", "powerports", PowerPort),
("poweroutlettemplates", "poweroutlets", PowerOutlet), ("poweroutlettemplates", "poweroutlets", PowerOutlet),
("rearporttemplates", "rearports", RearPort), ("rearporttemplates", "rearports", RearPort),
("frontporttemplates", "frontports", FrontPort) ("frontporttemplates", "frontports", FrontPort),
("modulebaytemplates", "modulebays", ModuleBay),
]: ]:
create_instances = [] create_instances = []
update_instances = [] update_instances = []