From 37854207dcb82a400faf1020eed8b72ef4dbe393 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Wed, 13 Nov 2019 12:27:25 +0100 Subject: [PATCH] Create database list view. --- musician/api.py | 1 + musician/models.py | 5 +++++ musician/views.py | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/musician/api.py b/musician/api.py index 9ed19af..eb138e1 100644 --- a/musician/api.py +++ b/musician/api.py @@ -13,6 +13,7 @@ API_PATHS = { 'my-account': 'accounts/', # services + 'database-list': 'databases/', 'domain-list': 'domains/', 'address-list': 'addresses/', 'mailbox-list': 'mailboxes/', diff --git a/musician/models.py b/musician/models.py index d73b7ab..c55acbd 100644 --- a/musician/models.py +++ b/musician/models.py @@ -17,6 +17,11 @@ class Service: return getattr(self, key, self.data.get(key)) +class DatabaseService(Service): + api_name = 'database' + fields = ('name', 'type', 'users') + + class MailService(Service): api_name = 'address' verbose_name = 'Mail' diff --git a/musician/views.py b/musician/views.py index 539619a..9945b8a 100644 --- a/musician/views.py +++ b/musician/views.py @@ -88,8 +88,8 @@ class MailingListsView(ServiceListView): service_class = MailinglistService -class DatabasesView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): - template_name = "musician/databases.html" +class DatabasesView(ServiceListView): + service_class = DatabaseService class SaasView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):