From 05fa27ac5718b38db8b57aa151c25798e3d05d7a Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 22 Apr 2020 20:02:30 +0200 Subject: [PATCH] Extract clubs mailing list --- apps/wei/management/commands/extract_ml_registrations.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/wei/management/commands/extract_ml_registrations.py b/apps/wei/management/commands/extract_ml_registrations.py index 5fd248ed..1b3853a6 100644 --- a/apps/wei/management/commands/extract_ml_registrations.py +++ b/apps/wei/management/commands/extract_ml_registrations.py @@ -6,7 +6,7 @@ from datetime import date from django.core.management import BaseCommand from django.db.models import Q -from member.models import Membership +from member.models import Membership, Club from ...models import WEIClub @@ -16,7 +16,7 @@ class Command(BaseCommand): "You can write this into a file with a pipe, then paste the document into your mail manager." def add_arguments(self, parser): - parser.add_argument('--type', '-t', choices=["members", "events", "art", "sport"], default="members", + parser.add_argument('--type', '-t', choices=["members", "clubs", "events", "art", "sport"], default="members", help='Select the type of the mailing list (default members)') parser.add_argument('--year', '-y', type=int, default=None, help='Select the year of the concerned WEI. Default: last year') @@ -31,6 +31,11 @@ class Command(BaseCommand): self.stdout.write(membership.user.email) return + if options["type"] == "clubs": + for club in Club.objects.all(): + self.stdout.write(club.email) + return + if options["year"] is None: wei = WEIClub.objects.order_by('-year').first() else: