b85957fdcb7839c13d8dafcfda921e8f9ebac4b2
[wolnelektury.git] / src / messaging / management / commands / messaging_send.py
1 from django.core.management.base import BaseCommand, CommandError
2 from messaging.models import EmailTemplate
3
4
5 class Command(BaseCommand):
6     help = 'Send emails defined in templates.'
7
8     def add_arguments(self, parser):
9         parser.add_argument('--dry-run', action='store_true', help='Dry run')
10
11     def handle(self, *args, **options):
12         for et in EmailTemplate.objects.filter(is_active=True):
13             et.run(verbose=True, dry_run=options['dry_run'])
14