diff --git a/src/postorius/templates/postorius/index.html b/src/postorius/templates/postorius/index.html index afa638a..dfce39b 100644 --- a/src/postorius/templates/postorius/index.html +++ b/src/postorius/templates/postorius/index.html @@ -13,7 +13,7 @@ {% if user.is_superuser %}
- {% if domain_count < 2 %} + {% if domain_count < 1 %} {% trans 'Create New Domain' %} {% else %} {% trans 'Create New List' %} diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 5146215..caee204 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -448,10 +448,7 @@ domains = Domain.objects.all() except MailmanApiError: return utils.render_api_error(request) - choosable_domains = [("", _("Choose a Domain"))] - for domain in domains: - choosable_domains.append((domain.mail_host, domain.mail_host)) - return choosable_domains + return [(d.mail_host, d.mail_host) for d in domains] @login_required @@ -467,8 +464,9 @@ be logged in to create a new list. """ mailing_list = None + choosable_domains = [('', _('Choose a Domain'))] +\ + _get_choosable_domains(request) if request.method == 'POST': - choosable_domains = _get_choosable_domains(request) form = ListNew(choosable_domains, request.POST) if form.is_valid(): # grab domain @@ -491,7 +489,6 @@ return render(request, 'postorius/errors/generic.html', {'error': e}) else: - choosable_domains = _get_choosable_domains(request) form = ListNew(choosable_domains, initial={'list_owner': request.user.email}) return render(request, template, {'form': form})