From 90ad13e61a0ec688b3b87888d78f1733729b7438 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 10:15:27 +0100 Subject: [PATCH] Define WebSite orchestra resource. --- musician/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/musician/models.py b/musician/models.py index 683d7aa..58d5d0c 100644 --- a/musician/models.py +++ b/musician/models.py @@ -263,3 +263,23 @@ class SaasService(OrchestraModel): 'is_active': True, '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)