sdi/views.py
branchanoop
changeset 246 3a32df4b3171
parent 242 6826f27064c9
--- a/sdi/views.py	Fri Sep 03 16:37:03 2010 +0530
+++ b/sdi/views.py	Tue Nov 09 12:02:42 2010 +0530
@@ -7,7 +7,7 @@
 
 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo
 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm, SendAccoForm, EditAddressForm
-from sage_days.sdi.events import send_reg_complete_mail, mail_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail
+from sage_days.sdi.events import send_reg_complete_mail, mail_invi, mail_cust_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail
 from sage_days.settings import APACHE_URL_PREFIX as aup
 
 def register(request):
@@ -116,6 +116,24 @@
         return render_to_response("send_invi.html", {"form":form})
 
 @login_required
+def send_cust_invi(request):
+    """ Take a list of csv email addresses and send mails to them.
+    """
+
+    if request.method == "POST":
+        form = EmailForm(request.POST)
+        if form.is_valid():
+            to_emails = form.cleaned_data['emails']
+            mail_cust_invi(to_emails)
+            return render_to_response("send_cust_invi.html", {"emails":to_emails})
+        else:
+            return render_to_response("send_cust_invi.html", {"form":form})
+    else:
+        form = EmailForm()
+        return render_to_response("send_cust_invi.html", {"form":form})
+
+
+@login_required
 def send_workshop_confirm(request):
     """ Show a list of all the ppl who requested for a workshop and 
     send a confirmation mail to them if not sent.