Housekeeping: reorganize format fields, simplify the building tasks.
[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.get_current().order_by('min_days_since'):
13             et.run(verbose=True, dry_run=options['dry_run'])
14