Browse Source

Implement a command to list email addresses of all members

Baptiste Jonglez 10 years ago
parent
commit
4b1098fcdb

+ 0 - 0
coin/members/management/__init__.py


+ 0 - 0
coin/members/management/commands/__init__.py


+ 15 - 0
coin/members/management/commands/members_email.py

@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.core.management.base import BaseCommand, CommandError
+
+from coin.members.models import Member
+
+
+class Command(BaseCommand):
+    help = 'Returns the email addresses of all members, in a format suitable for bulk importing in Sympa'
+
+    def handle(self, *args, **options):
+        emails = [m.email for m in Member.objects.filter(status='member')]
+        for email in emails:
+            self.stdout.write(email)