From 6d7ee0b76a9798d9dbe1d21243eb2822e5a7566b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 27 Sep 2021 13:37:11 +0200 Subject: [PATCH] Refactor Addresses list view --- musician/models.py | 7 +++++- musician/templates/musician/addresses.html | 26 ++++++++++------------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/musician/models.py b/musician/models.py index a470a65..9742f8c 100644 --- a/musician/models.py +++ b/musician/models.py @@ -231,7 +231,12 @@ class Address(OrchestraModel): verbose_name = _('Mail addresses') description = _('Description details for mail addresses page.') fields = ('mail_address', 'aliases', 'type', 'type_detail') - param_defaults = {"id": None,} + param_defaults = { + "id": None, + "domain": None, + "mailboxes": [], + "forward": None, + } FORWARD = 'forward' MAILBOX = 'mailbox' diff --git a/musician/templates/musician/addresses.html b/musician/templates/musician/addresses.html index 3c2e6f5..5c0c757 100644 --- a/musician/templates/musician/addresses.html +++ b/musician/templates/musician/addresses.html @@ -6,31 +6,29 @@ - - - + + + - - - - + + + + {% for obj in object_list %} - - + + {% endfor %}
{% trans "Mail address" %}{% trans "Aliases" %}{% trans "Type" %}{% trans "Type details" %}{% trans "Email" %}{% trans "Domain" %}{% trans "Mailboxes" %}{% trans "Forward" %}
{{ obj.mail_address }}{{ obj.aliases|join:" , " }}{{ obj.type|capfirst }}{{ obj.domain.name }} - {% if obj.type == 'mailbox' %} - {% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %} - {% else %} - {{ obj.type_detail }} - {% endif %} + {% for mailbox in obj.mailboxes %} + {{ mailbox.name }} + {% endfor %} {{ obj.forward }}