scripts/mails.py
changeset 42 efacdf0cd268
child 44 c390adb66ba6
equal deleted inserted replaced
41:cf02d105aea2 42:efacdf0cd268
       
     1 """Helper script to send emails to the users to remind of the
       
     2 registration and inform them to complete their profiles and stuff.
       
     3 """
       
     4 
       
     5 
       
     6 __authors__ = [
       
     7   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
       
     8   ]
       
     9 
       
    10 
       
    11 from django.template import loader
       
    12 
       
    13 from project.kiwipycon.talk.models import Talk
       
    14 
       
    15 
       
    16 def speaker_accepted():
       
    17     """Sends a mail to each speaker whose talk has been accepted
       
    18     informing them about the same.
       
    19     """
       
    20 
       
    21     talks = Talk.objects.all()
       
    22 
       
    23     template = 'notifications/speaker_accepted_mail.html'
       
    24 
       
    25     for talk in talks:
       
    26         subject = 'Your talk has been selected for SciPy.in 2009!'
       
    27         message = loader.render_to_string(
       
    28             template, dictionary={'name': talk.speaker.username,
       
    29                                   'title': talk.title})
       
    30 
       
    31         talk.speaker.email_user(subject=subject, message=message,
       
    32                                 from_email='admin@scipy.in')