diff --git a/src/postorius/templates/postorius/lists/members.html b/src/postorius/templates/postorius/lists/members.html
index 5fccd41..818bb9b 100644
--- a/src/postorius/templates/postorius/lists/members.html
+++ b/src/postorius/templates/postorius/lists/members.html
@@ -71,6 +71,10 @@
+
+
{% for member in list.member_page %}
diff --git a/src/postorius/urls.py b/src/postorius/urls.py
index c4da4ac..fb326df 100644
--- a/src/postorius/urls.py
+++ b/src/postorius/urls.py
@@ -29,6 +29,8 @@
url(r'^members/(?P\d+)/$',
ListMembersView.as_view(
), name='list_members_paged'),
+ url(r'^csv_view/$',
+ 'csv_view' , name='csv_view'),
url(r'^members/$',
ListMembersView.as_view(
), name='list_members'),
diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py
index a60d634..0de0908 100644
--- a/src/postorius/views/list.py
+++ b/src/postorius/views/list.py
@@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
import logging
+import csv
+
+from django.http import HttpResponse
from django.conf import settings
from django.contrib import messages
@@ -35,7 +38,6 @@
from postorius.auth.decorators import *
from postorius.views.generic import MailingListView
-
logger = logging.getLogger(__name__)
@@ -268,6 +270,30 @@
return redirect('mass_subscribe', self.mailing_list.list_id)
+def csv_view(request, list_id):
+ """Export all the subscriber in csv
+ """
+ error = None
+ mm_lists = []
+ if request.user.is_superuser:
+ only_public = False
+ try:
+ client = utils.get_client()
+ mm_lists= client.get_list(list_id)
+ except MailmanApiError:
+ return utils.render_api_error(request)
+
+ response = HttpResponse(content_type='text/csv')
+ response['Content-Disposition'] = 'attachment; filename="Subscribers.csv"'
+
+ writer = csv.writer(response)
+ if mm_lists:
+ for i in mm_lists.members:
+ writer.writerow([i.email])
+
+ return response
+
+
def _get_choosable_domains(request):
try:
domains = Domain.objects.all()
@@ -326,7 +352,6 @@
return render_to_response(template, {'form': form},
context_instance=RequestContext(request))
-
def list_index(request, template='postorius/lists/index.html'):
"""Show a table of all public mailing lists.
"""
|