From 2c655f6b08b32959e0691044ddc84d14a643640c Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Fri, 26 Jan 2024 13:35:10 +0100 Subject: [PATCH] Cosmetics & filter by request.user missing views --- orchestra/contrib/musician/urls.py | 4 ++-- orchestra/contrib/musician/views.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/orchestra/contrib/musician/urls.py b/orchestra/contrib/musician/urls.py index 9e5190f8..0114719e 100644 --- a/orchestra/contrib/musician/urls.py +++ b/orchestra/contrib/musician/urls.py @@ -31,12 +31,12 @@ urlpatterns = [ path('address/new/', views.MailCreateView.as_view(), name='address-create'), path('address//', views.MailUpdateView.as_view(), name='address-update'), path('address//delete/', views.AddressDeleteView.as_view(), name='address-delete'), - path('mailboxes/', views.MailboxesView.as_view(), name='mailbox-list'), + path('mailboxes/', views.MailboxListView.as_view(), name='mailbox-list'), path('mailboxes/new/', views.MailboxCreateView.as_view(), name='mailbox-create'), path('mailboxes//', views.MailboxUpdateView.as_view(), name='mailbox-update'), path('mailboxes//delete/', views.MailboxDeleteView.as_view(), name='mailbox-delete'), path('mailboxes//change-password/', views.MailboxChangePasswordView.as_view(), name='mailbox-password'), path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'), path('databases/', views.DatabasesView.as_view(), name='database-list'), - path('saas/', views.SaasView.as_view(), name='saas-list'), + path('saas/', views.SaasListView.as_view(), name='saas-list'), ] diff --git a/orchestra/contrib/musician/views.py b/orchestra/contrib/musician/views.py index c338bc92..b15fa2a3 100644 --- a/orchestra/contrib/musician/views.py +++ b/orchestra/contrib/musician/views.py @@ -340,7 +340,7 @@ class MailingListsView(ServiceListView): return {} -class MailboxesView(ServiceListView): +class MailboxListView(ServiceListView): service_class = MailboxService model = Mailbox template_name = "musician/mailboxes.html" @@ -388,6 +388,9 @@ class MailboxUpdateView(CustomContextMixin, UserTokenRequiredMixin, UpdateView): success_url = reverse_lazy("musician:mailbox-list") extra_context = {'service': service_class} + def get_queryset(self): + return self.model.objects.filter(account=self.request.user) + class MailboxDeleteView(CustomContextMixin, UserTokenRequiredMixin, DeleteView): model = Mailbox @@ -422,6 +425,9 @@ class MailboxChangePasswordView(CustomContextMixin, UserTokenRequiredMixin, Upda form_class = MailboxChangePasswordForm success_url = reverse_lazy("musician:mailbox-list") + def get_queryset(self): + return self.model.objects.filter(account=self.request.user) + class DatabasesView(ServiceListView): template_name = "musician/databases.html" @@ -433,7 +439,7 @@ class DatabasesView(ServiceListView): } -class SaasView(ServiceListView): +class SaasListView(ServiceListView): service_class = SaasService model = SaaS template_name = "musician/saas.html"