emaillist.py 431 Bytes
Newer Older
1 2 3
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User

4

5
class Command(BaseCommand):
6
    help = 'Extract an e-mail list of all active students.'
7

8 9 10 11 12 13 14 15
    def handle(self, *args, **options):
        #text = open(args[0]).read()
        #subject = open(args[1]).read()
        users = User.objects.all()

        for user in users:
            if user.is_active:
                print user.email