diff --git a/musician/templates/musician/mail.html b/musician/templates/musician/mail.html index f247653..e8ae8be 100644 --- a/musician/templates/musician/mail.html +++ b/musician/templates/musician/mail.html @@ -2,8 +2,11 @@ {% load i18n %} {% block content %} +{% if active_domain %} +{% trans "Go to global" %} +{% endif %} -

{{ service.verbose_name }}

+

{{ service.verbose_name }}{% if active_domain %} {% trans "for" %} {{ active_domain.name }}{% endif %}

{{ service.description }}

diff --git a/musician/views.py b/musician/views.py index 7ad9187..c45517f 100644 --- a/musician/views.py +++ b/musician/views.py @@ -177,10 +177,19 @@ class MailView(ServiceListView): def get_queryfilter(self): """Retrieve query params (if any) to filter queryset""" domain_id = self.request.GET.get('domain') - if domain_id is None: - return '' + if domain_id: + return "domain={}".format(domain_id) - return "domain={}".format(domain_id) + return '' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + domain_id = self.request.GET.get('domain') + if domain_id: + context.update({ + 'active_domain': self.orchestra.retrieve_domain(domain_id) + }) + return context class MailingListsView(ServiceListView):