Define WebSite orchestra resource.

This commit is contained in:
Santiago Lamora 2020-01-20 10:15:27 +01:00
parent 160e0b059f
commit 90ad13e61a
1 changed files with 20 additions and 0 deletions

View File

@ -263,3 +263,23 @@ class SaasService(OrchestraModel):
'is_active': True, 'is_active': True,
'data': {}, 'data': {},
} }
class WebSite(OrchestraModel):
api_name = 'website'
param_defaults = {
"id": None,
"name": None,
"protocol": None,
"is_active": True,
"domains": [],
"contents": [],
}
@classmethod
def new_from_json(cls, data, **kwargs):
domains = cls.param_defaults.get("domains")
if 'domains' in data:
domains = [Domain.new_from_json(domain_data) for domain_data in data['domains']]
return super().new_from_json(data=data, domains=domains)