from django.core.management.base import BaseCommand, CommandError from products.models import * from products.sendmsg import send_email from django.db import transaction class Command(BaseCommand): help = 'Send a message to admin/tenant' def add_arguments(self, parser): parser.add_argument('to') parser.add_argument('subject') parser.add_argument('content') def handle(self, *args, **options): send_email(options['to'], options['subject'], options['content'])