from django.core.management.base import BaseCommand from apps.notification.tasks import send_certificates class Command(BaseCommand): help = 'Send certificates at the end of subscription' def add_arguments(self, parser): # Named (optional) arguments parser.add_argument( '--email', dest='email', help='Test email', ) parser.add_argument( '--date', dest='date', help='Date in format 22-03-2018', ) parser.add_argument( '--dry-run', action='store_true', dest='dry_run', help='Only display emails', ) def handle(self, *args, **options): send_certificates(email=options.get('email'), date_end=options.get('date'), dry_run=options.get('dry_run'))