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)
|
name = CharField(max_length=255)
|
||||||
description = TextField(null=True, blank=True)
|
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)
|
product_groups = ManyToManyField(ProductGroup)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def handler(self):
|
def handler(self):
|
||||||
if self.handler_module:
|
if self.service_type:
|
||||||
try:
|
try:
|
||||||
handler_module = import_module(self.handler_module)
|
service_type = import_module(self.service_type)
|
||||||
return handler_module.ProductRouter(self.id)
|
return service_type.ServiceRouter(self)
|
||||||
except Exception as e:
|
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
|
return None
|
||||||
|
|
||||||
class ServicePlan(Model):
|
class ServicePlan(Model):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue