from django.core.management.base import BaseCommand from apps.notification.tasks import send_camp_certificates class Command(BaseCommand): help = 'Send camp certificates at the end of month' def add_arguments(self, parser): # Named (optional) arguments parser.add_argument( '--email', dest='email', help='Test email', ) parser.add_argument( '--cert', dest='certificate_number', type=int, help='Certificate number', ) parser.add_argument( '--dry-run', action='store_true', dest='dry_run', help='Only display emails', ) def handle(self, *args, **options): send_camp_certificates(email=options.get('email'), certificate_number=options.get('certificate_number'), dry_run=options.get('dry_run'))