Ashish has proposed merging lp:~coolyashish/postorius/postorius into
lp:postorius.
Requested reviews:
Mailman Coders (mailman-coders)
For more details, see:
https://code.launchpad.net/~coolyashish/postorius/postorius/+merge/252088
--
Your team Mailman Coders is requested to review the proposed merge of
lp:~coolyashish/postorius/postorius into lp:postorius.
=== modified file 'src/postorius/templates/postorius/lists/members.html'
--- src/postorius/templates/postorius/lists/members.html 2015-01-17 17:23:59 +0000
+++ src/postorius/templates/postorius/lists/members.html 2015-03-06 11:40:24 +0000
@@ -71,6 +71,10 @@
</tr>
</thead>
<tbody>
+ <form action="{% url 'csv_view' list.list_id %}" method="post" class="well"> {% csrf_token %}
+ <button type="submit" class="btn">{% trans 'CSV Export' %}</button>
+ </form>
+
{% for member in list.member_page %}
<tr>
<td> <a href="{% url 'list_member_options' list.fqdn_listname member.email %}">
=== modified file 'src/postorius/urls.py'
--- src/postorius/urls.py 2015-02-09 14:35:44 +0000
+++ src/postorius/urls.py 2015-03-06 11:40:24 +0000
@@ -29,6 +29,8 @@
url(r'^members/(?P<page>\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'),
=== modified file 'src/postorius/views/list.py'
--- src/postorius/views/list.py 2015-02-09 14:35:44 +0000
+++ src/postorius/views/list.py 2015-03-06 11:40:24 +0000
@@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see <http://www.gnu.org/licenses/>.
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.
"""
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders