diff --git a/templates/mailman-django/base.html b/templates/mailman-django/base.html index bd053d0..7d22eaf 100644 --- a/templates/mailman-django/base.html +++ b/templates/mailman-django/base.html @@ -20,8 +20,8 @@ - - + + @@ -29,10 +29,10 @@ - +
{% include "mailman-django/list_selector.html" %}
- + diff --git a/templates/mailman-django/list_selector.html b/templates/mailman-django/list_selector.html new file mode 100644 index 0000000..cafd4ab --- /dev/null +++ b/templates/mailman-django/list_selector.html @@ -0,0 +1,15 @@ +{% load i18n %} + +{% block selector %} + +
+ + +
+ + +{% endblock %} diff --git a/tests/tests.py b/tests/tests.py index 0db7d1f..07108f7 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -50,6 +50,8 @@ ================= Try to access some of the admin Pages. Accessing these pages redirects to a login page since we need admin authority to view and use them +#TODO - ACL tests will be implemented for each site at a central place at later stages of development. +Please be aware that this test only checks for authentification ONCE. >>> response = c.get('/new_domain/') @@ -173,4 +175,6 @@ >>> print "All mailing lists" in response.content True + +TODO: Delete Domains """ diff --git a/views.py b/views.py index 6c6c011..d139afe 100644 --- a/views.py +++ b/views.py @@ -18,7 +18,7 @@ from django.http import HttpResponse, HttpResponseRedirect from django.template import Context, loader -from django.shortcuts import render_to_response +from django.shortcuts import render_to_response, redirect from django.core.urlresolvers import reverse from django.utils.translation import gettext as _ import re @@ -101,10 +101,18 @@ form = DomainNew() try: existing_domains = c.domains + + #WEB List selector → TODO → MOVE to Context Processors + web_host = request.META["HTTP_HOST"].split(":") + if len(web_host) == 2: + web_host = web_host[0] + d = c.get_domain(None,web_host) + all_lists = c.lists #TODO get filtered by Domain ! + except Exception, e: return HttpResponse(e) - return render_to_response(template, {'form': form,'domains':existing_domains}) + return render_to_response(template, {'form': form,'domains':existing_domains,'lists':all_lists}) @login_required def administration(request, template = 'mailman-django/lists/new.html'): @@ -178,18 +186,22 @@ def list_index(request, template = 'mailman-django/lists/index.html'): """Show a table of all mailing lists. """ - try: - c = Client('http://localhost:8001/3.0', API_USER, API_PASS) - except Exception, e: - return render_to_response('mailman-django/errors/generic.html', - {'message': "Unexpected error:"+ e.message}) + if request.method == 'POST': + return redirect("/lists/"+request.POST["list"]) + + else: + try: + c = Client('http://localhost:8001/3.0', API_USER, API_PASS) + except Exception, e: + return render_to_response('mailman-django/errors/generic.html', + {'message': "Unexpected error:"+ e.message}) - try: - lists = c.lists - return render_to_response(template, {'lists': lists}) - except Exception, e: - return render_to_response('mailman-django/errors/generic.html', - {'message': "Unexpected error:"+ e.message}) + try: + lists = c.lists + return render_to_response(template, {'lists': lists}) + except Exception, e: + return render_to_response('mailman-django/errors/generic.html', + {'message': "Unexpected error:"+ e.message}) def list_info(request, fqdn_listname = None,