Fix reverted Service model
This commit is contained in:
parent
b171cd7974
commit
6b645d07ed
1 changed files with 5 additions and 5 deletions
|
@ -14,17 +14,17 @@ class Service(Model):
|
|||
|
||||
name = CharField(max_length=255)
|
||||
description = TextField(null=True, blank=True)
|
||||
handler_module = CharField(max_length=255, null=True, blank=True)
|
||||
service_type = CharField(max_length=255, null=True, blank=True)
|
||||
product_groups = ManyToManyField(ProductGroup)
|
||||
|
||||
@property
|
||||
def handler(self):
|
||||
if self.handler_module:
|
||||
if self.service_type:
|
||||
try:
|
||||
handler_module = import_module(self.handler_module)
|
||||
return handler_module.ProductRouter(self.id)
|
||||
service_type = import_module(self.service_type)
|
||||
return service_type.ServiceRouter(self)
|
||||
except Exception as e:
|
||||
logger.error(f"Could not load product handler {self.handler_module} for product {self.id}: {e}")
|
||||
logger.error(f"Could not load product handler {self.service_type} for product {self.id}: {e}")
|
||||
return None
|
||||
|
||||
class ServicePlan(Model):
|
||||
|
|
Loading…
Reference in a new issue