From 5ae7334b389a292e971e24f493d478d322ee4162 Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Sat, 3 Mar 2012 15:46:28 -0500 Subject: [PATCH] Extract email list from DB --- student/management/commands/emaillist.py | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 student/management/commands/emaillist.py diff --git a/student/management/commands/emaillist.py b/student/management/commands/emaillist.py new file mode 100644 index 0000000000..ac4ce33845 --- /dev/null +++ b/student/management/commands/emaillist.py @@ -0,0 +1,26 @@ +import os.path + +from lxml import etree + +from django.core.management.base import BaseCommand +from django.conf import settings +from django.contrib.auth.models import User + +import mitxmako.middleware as middleware + +middleware.MakoMiddleware() + +class Command(BaseCommand): + help = \ +'''Sends an e-mail to all users. Takes a single +parameter -- name of e-mail template -- located +in templates/email. Adds a .txt for the message +body, and an _subject.txt for the subject. ''' + 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