diff --git a/musician/api.py b/musician/api.py index 0536b5c..dcfe7e2 100644 --- a/musician/api.py +++ b/musician/api.py @@ -18,6 +18,7 @@ API_PATHS = { # services 'database-list': 'databases/', 'domain-list': 'domains/', + 'domain-detail': 'domains/{pk}/', 'address-list': 'addresses/', 'mailbox-list': 'mailboxes/', 'mailinglist-list': 'lists/', @@ -55,9 +56,13 @@ class Orchestra(object): return response.json().get("token", None) - def request(self, verb, resource, querystring=None, raise_exception=True): + def request(self, verb, resource=None, querystring=None, url=None, raise_exception=True): assert verb in ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE"] - url = self.build_absolute_uri(resource) + if resource is not None: + url = self.build_absolute_uri(resource) + elif url is None: + raise AttributeError("Provide `resource` or `url` params") + if querystring is not None: url = "{}?{}".format(url, querystring) @@ -86,6 +91,13 @@ class Orchestra(object): raise PermissionError("Cannot retrieve profile of an anonymous user.") return UserAccount.new_from_json(output[0]) + def retrieve_domain(self, pk): + path = API_PATHS.get('domain-detail').format_map({'pk': pk}) + + url = urllib.parse.urljoin(self.base_url, path) + status, domain_json = self.request("GET", url=url) + return Domain.new_from_json(domain_json) + def retrieve_domain_list(self): output = self.retrieve_service_list(Domain.api_name) domains = [] diff --git a/musician/templates/musician/domain_detail.html b/musician/templates/musician/domain_detail.html new file mode 100644 index 0000000..6cb459e --- /dev/null +++ b/musician/templates/musician/domain_detail.html @@ -0,0 +1,28 @@ +{% extends "musician/base.html" %} +{% load i18n %} + +{% block content %} +
Litle description of what to be expected in this section to aid the user. Even a link to more help if there is one available.
+ +{% trans "Type" %} | +{% trans "Value" %} | +
---|---|
{{ record.type }} | +{{ record.value }} | +