Compare commits
No commits in common. "d7e8a411cd0a31f01582b5d964d0b299cc00de31" and "790ac0074a93cc2b7290dd129eb2f540a4707e6d" have entirely different histories.
d7e8a411cd
...
790ac0074a
|
@ -70,7 +70,7 @@
|
||||||
<h4>{% trans "Mail" %}</h4>
|
<h4>{% trans "Mail" %}</h4>
|
||||||
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
||||||
<p class="card-text text-dark">
|
<p class="card-text text-dark">
|
||||||
{{ domain.addresses.count }} {% trans "mail addresses created" %}
|
{{ domain.addresses|length }} {% trans "mail addresses created" %}
|
||||||
</p>
|
</p>
|
||||||
<a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
|
<a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,12 +31,12 @@ urlpatterns = [
|
||||||
path('address/new/', views.MailCreateView.as_view(), name='address-create'),
|
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>/', views.MailUpdateView.as_view(), name='address-update'),
|
||||||
path('address/<int:pk>/delete/', views.AddressDeleteView.as_view(), name='address-delete'),
|
path('address/<int:pk>/delete/', views.AddressDeleteView.as_view(), name='address-delete'),
|
||||||
path('mailboxes/', views.MailboxListView.as_view(), name='mailbox-list'),
|
path('mailboxes/', views.MailboxesView.as_view(), name='mailbox-list'),
|
||||||
path('mailboxes/new/', views.MailboxCreateView.as_view(), name='mailbox-create'),
|
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>/', views.MailboxUpdateView.as_view(), name='mailbox-update'),
|
||||||
path('mailboxes/<int:pk>/delete/', views.MailboxDeleteView.as_view(), name='mailbox-delete'),
|
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('mailboxes/<int:pk>/change-password/', views.MailboxChangePasswordView.as_view(), name='mailbox-password'),
|
||||||
path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'),
|
path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'),
|
||||||
path('databases/', views.DatabasesView.as_view(), name='database-list'),
|
path('databases/', views.DatabasesView.as_view(), name='database-list'),
|
||||||
path('saas/', views.SaasListView.as_view(), name='saas-list'),
|
path('saas/', views.SaasView.as_view(), name='saas-list'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -340,7 +340,7 @@ class MailingListsView(ServiceListView):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class MailboxListView(ServiceListView):
|
class MailboxesView(ServiceListView):
|
||||||
service_class = MailboxService
|
service_class = MailboxService
|
||||||
model = Mailbox
|
model = Mailbox
|
||||||
template_name = "musician/mailboxes.html"
|
template_name = "musician/mailboxes.html"
|
||||||
|
@ -388,9 +388,6 @@ class MailboxUpdateView(CustomContextMixin, UserTokenRequiredMixin, UpdateView):
|
||||||
success_url = reverse_lazy("musician:mailbox-list")
|
success_url = reverse_lazy("musician:mailbox-list")
|
||||||
extra_context = {'service': service_class}
|
extra_context = {'service': service_class}
|
||||||
|
|
||||||
def get_queryset(self):
|
|
||||||
return self.model.objects.filter(account=self.request.user)
|
|
||||||
|
|
||||||
|
|
||||||
class MailboxDeleteView(CustomContextMixin, UserTokenRequiredMixin, DeleteView):
|
class MailboxDeleteView(CustomContextMixin, UserTokenRequiredMixin, DeleteView):
|
||||||
model = Mailbox
|
model = Mailbox
|
||||||
|
@ -425,9 +422,6 @@ class MailboxChangePasswordView(CustomContextMixin, UserTokenRequiredMixin, Upda
|
||||||
form_class = MailboxChangePasswordForm
|
form_class = MailboxChangePasswordForm
|
||||||
success_url = reverse_lazy("musician:mailbox-list")
|
success_url = reverse_lazy("musician:mailbox-list")
|
||||||
|
|
||||||
def get_queryset(self):
|
|
||||||
return self.model.objects.filter(account=self.request.user)
|
|
||||||
|
|
||||||
|
|
||||||
class DatabasesView(ServiceListView):
|
class DatabasesView(ServiceListView):
|
||||||
template_name = "musician/databases.html"
|
template_name = "musician/databases.html"
|
||||||
|
@ -439,7 +433,7 @@ class DatabasesView(ServiceListView):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SaasListView(ServiceListView):
|
class SaasView(ServiceListView):
|
||||||
service_class = SaasService
|
service_class = SaasService
|
||||||
model = SaaS
|
model = SaaS
|
||||||
template_name = "musician/saas.html"
|
template_name = "musician/saas.html"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import sys
|
import sys
|
||||||
from contextlib import ContextDecorator
|
|
||||||
from threading import local
|
from threading import local
|
||||||
|
|
||||||
from django.contrib.admin.models import LogEntry
|
from django.contrib.admin.models import LogEntry
|
||||||
from django.db.models.signals import m2m_changed, post_save, pre_delete
|
from django.db.models.signals import pre_delete, post_save, m2m_changed
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
from django.utils.decorators import ContextDecorator
|
||||||
|
|
||||||
from orchestra.utils.python import OrderedSet
|
from orchestra.utils.python import OrderedSet
|
||||||
|
|
||||||
from . import Operation, helpers, manager
|
from . import manager, Operation, helpers
|
||||||
from .middlewares import OperationsMiddleware
|
from .middlewares import OperationsMiddleware
|
||||||
from .models import BackendLog, BackendOperation
|
from .models import BackendLog, BackendOperation
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ def m2m_collector(sender, *args, **kwargs):
|
||||||
class orchestrate(ContextDecorator):
|
class orchestrate(ContextDecorator):
|
||||||
"""
|
"""
|
||||||
Context manager for triggering backend operations out of request-response cycle, e.g. shell
|
Context manager for triggering backend operations out of request-response cycle, e.g. shell
|
||||||
|
|
||||||
with orchestrate():
|
with orchestrate():
|
||||||
user = SystemUser.objects.get(username='rata')
|
user = SystemUser.objects.get(username='rata')
|
||||||
user.shell = '/dev/null'
|
user.shell = '/dev/null'
|
||||||
|
@ -46,7 +46,7 @@ class orchestrate(ContextDecorator):
|
||||||
thread_locals = local()
|
thread_locals = local()
|
||||||
thread_locals.pending_operations = None
|
thread_locals.pending_operations = None
|
||||||
thread_locals.route_cache = None
|
thread_locals.route_cache = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def collect(cls, action, **kwargs):
|
def collect(cls, action, **kwargs):
|
||||||
""" Collects all pending operations derived from model signals """
|
""" Collects all pending operations derived from model signals """
|
||||||
|
@ -57,14 +57,14 @@ class orchestrate(ContextDecorator):
|
||||||
kwargs['route_cache'] = cls.thread_locals.route_cache
|
kwargs['route_cache'] = cls.thread_locals.route_cache
|
||||||
instance = kwargs.pop('instance')
|
instance = kwargs.pop('instance')
|
||||||
manager.collect(instance, action, **kwargs)
|
manager.collect(instance, action, **kwargs)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
cls = type(self)
|
cls = type(self)
|
||||||
self.old_pending_operations = cls.thread_locals.pending_operations
|
self.old_pending_operations = cls.thread_locals.pending_operations
|
||||||
cls.thread_locals.pending_operations = OrderedSet()
|
cls.thread_locals.pending_operations = OrderedSet()
|
||||||
self.old_route_cache = cls.thread_locals.route_cache
|
self.old_route_cache = cls.thread_locals.route_cache
|
||||||
cls.thread_locals.route_cache = {}
|
cls.thread_locals.route_cache = {}
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
cls = type(self)
|
cls = type(self)
|
||||||
if not exc_type:
|
if not exc_type:
|
||||||
|
|
Loading…
Reference in New Issue