Compare commits

..

3 Commits

Author SHA1 Message Date
Santiago L d7e8a411cd Import ContextDecorator from contextlib
Will be removed on Django 3.0
2024-01-26 13:36:02 +01:00
Santiago L 2c655f6b08 Cosmetics & filter by request.user missing views 2024-01-26 13:35:10 +01:00
Santiago L 4b89a04969 Fix number of addresses of a domain 2024-01-26 13:34:46 +01:00
4 changed files with 18 additions and 12 deletions

View File

@ -70,7 +70,7 @@
<h4>{% trans "Mail" %}</h4>
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
<p class="card-text text-dark">
{{ domain.addresses|length }} {% trans "mail addresses created" %}
{{ domain.addresses.count }} {% trans "mail addresses created" %}
</p>
<a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
</div>

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"

View File

@ -1,14 +1,14 @@
import sys
from contextlib import ContextDecorator
from threading import local
from django.contrib.admin.models import LogEntry
from django.db.models.signals import pre_delete, post_save, m2m_changed
from django.db.models.signals import m2m_changed, post_save, pre_delete
from django.dispatch import receiver
from django.utils.decorators import ContextDecorator
from orchestra.utils.python import OrderedSet
from . import manager, Operation, helpers
from . import Operation, helpers, manager
from .middlewares import OperationsMiddleware
from .models import BackendLog, BackendOperation