From 6980522d811e2ff9ff5e0be7e12c54a0863a5ba8 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 10:20:26 +0100 Subject: [PATCH] Make more descriptive variable names. --- musician/templates/musician/dashboard.html | 4 ++-- musician/views.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index 90c8811..c6de4e3 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -62,9 +62,9 @@

{{ domain.mails|length }} {% trans "mail addresses created" %} - {% if domain.address_left.alert %} + {% if domain.address_left.alert_level %}
- {{ domain.address_left.count }} mail address left + {{ domain.address_left.count }} mail address left {% endif %}

diff --git a/musician/views.py b/musician/views.py index bbff6a0..e96fa24 100644 --- a/musician/views.py +++ b/musician/views.py @@ -66,16 +66,16 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): # TODO(@slamora): validate concept of limits with Pangea profile_type = context['profile'].type for domain in domains: - address_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails) - alert = None - if address_left == 1: - alert = 'warning' - elif address_left < 1: - alert = 'danger' + addresses_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails) + alert_level = None + if addresses_left == 1: + alert_level = 'warning' + elif addresses_left < 1: + alert_level = 'danger' - domain.address_left = { - 'count': address_left, - 'alert': alert, + domain.addresses_left = { + 'count': addresses_left, + 'alert_level': alert_level, } context.update({