scripts/mails.py
changeset 48 bb835205604b
parent 47 668e7e0881b6
child 61 959ec5eaafb1
--- a/scripts/mails.py	Sat Dec 05 10:12:39 2009 +0530
+++ b/scripts/mails.py	Tue Dec 08 12:21:09 2009 +0530
@@ -9,9 +9,10 @@
 
 
 from django.template import loader
+from django.contrib.auth.models import User
 
+from project.kiwipycon.registration.models import Registration
 from project.kiwipycon.talk.models import Talk
-from django.contrib.auth.models import User
 
 
 def speaker_accepted():
@@ -67,4 +68,40 @@
             template, dictionary={'name': reg.username})
 
         reg.email_user(subject=subject, message=message,
-                       from_email='madhusudancs@gmail.com')
\ No newline at end of file
+                       from_email='madhusudancs@gmail.com')
+
+
+def delegate_about_event():
+    """Sends a mail to each confirmed delegate informing
+    them about the the individual events.
+    """
+
+    regs = Registration.objects.all()
+
+    template = 'notifications/sprints_about_mail.html'
+
+    for reg in regs:
+        subject = 'SciPy.in 2009: Details of the individual events'
+        message = loader.render_to_string(
+            template, dictionary={'name': reg.registrant.username})
+
+        reg.registrant.email_user(subject=subject, message=message,
+                                  from_email='madhusudancs@gmail.com')
+
+
+def speaker_confirmation():
+    """Sends a mail to each speaker asking for confirmation.
+    """
+
+    talks = Talk.objects.all()
+
+    template = 'notifications/speaker_confirmation_mail.html'
+
+    for talk in talks:
+        subject = 'SciPy.in 2009: Requesting for confirmation of your talk'
+        message = loader.render_to_string(
+            template, dictionary={'name': talk.speaker.username,
+                                  'title': talk.title})
+
+        talk.speaker.email_user(subject=subject, message=message,
+                                from_email='admin@scipy.in')