Cosmetics & filter by request.user missing views

This commit is contained in:
Santiago L 2024-01-26 13:35:10 +01:00
parent 4b89a04969
commit 2c655f6b08
2 changed files with 10 additions and 4 deletions

View File

@ -31,12 +31,12 @@ urlpatterns = [
path('address/new/', views.MailCreateView.as_view(), name='address-create'),
path('address/<int:pk>/', views.MailUpdateView.as_view(), name='address-update'),
path('address/<int:pk>/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/<int:pk>/', views.MailboxUpdateView.as_view(), name='mailbox-update'),
path('mailboxes/<int:pk>/delete/', views.MailboxDeleteView.as_view(), name='mailbox-delete'),
path('mailboxes/<int:pk>/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'),
]

View File

@ -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"