fix(itim): Ensure service config from template is not gathered if not defined

ref: #15 #248 #356
This commit is contained in:
2024-10-21 18:38:00 +09:30
parent a7c9ff4cee
commit a230edf25a

View File

@ -334,23 +334,22 @@ class Service(TenancyObject):
@property
def config_variables(self):
if self.is_template:
config: dict = {}
return self.config
if self.template:
template_config: dict = Service.objects.get(id=self.template.id).config
if self.template.config:
template_config.update(self.config)
config.update(self.template.config)
return template_config
else:
if self.config:
return self.config
config.update(self.config)
return config
return None
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):