scripts/mails.py
changeset 48 bb835205604b
parent 47 668e7e0881b6
child 61 959ec5eaafb1
equal deleted inserted replaced
47:668e7e0881b6 48:bb835205604b
     7   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
     7   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
     8   ]
     8   ]
     9 
     9 
    10 
    10 
    11 from django.template import loader
    11 from django.template import loader
       
    12 from django.contrib.auth.models import User
    12 
    13 
       
    14 from project.kiwipycon.registration.models import Registration
    13 from project.kiwipycon.talk.models import Talk
    15 from project.kiwipycon.talk.models import Talk
    14 from django.contrib.auth.models import User
       
    15 
    16 
    16 
    17 
    17 def speaker_accepted():
    18 def speaker_accepted():
    18     """Sends a mail to each speaker whose talk has been accepted
    19     """Sends a mail to each speaker whose talk has been accepted
    19     informing them about the same.
    20     informing them about the same.
    66         message = loader.render_to_string(
    67         message = loader.render_to_string(
    67             template, dictionary={'name': reg.username})
    68             template, dictionary={'name': reg.username})
    68 
    69 
    69         reg.email_user(subject=subject, message=message,
    70         reg.email_user(subject=subject, message=message,
    70                        from_email='madhusudancs@gmail.com')
    71                        from_email='madhusudancs@gmail.com')
       
    72 
       
    73 
       
    74 def delegate_about_event():
       
    75     """Sends a mail to each confirmed delegate informing
       
    76     them about the the individual events.
       
    77     """
       
    78 
       
    79     regs = Registration.objects.all()
       
    80 
       
    81     template = 'notifications/sprints_about_mail.html'
       
    82 
       
    83     for reg in regs:
       
    84         subject = 'SciPy.in 2009: Details of the individual events'
       
    85         message = loader.render_to_string(
       
    86             template, dictionary={'name': reg.registrant.username})
       
    87 
       
    88         reg.registrant.email_user(subject=subject, message=message,
       
    89                                   from_email='madhusudancs@gmail.com')
       
    90 
       
    91 
       
    92 def speaker_confirmation():
       
    93     """Sends a mail to each speaker asking for confirmation.
       
    94     """
       
    95 
       
    96     talks = Talk.objects.all()
       
    97 
       
    98     template = 'notifications/speaker_confirmation_mail.html'
       
    99 
       
   100     for talk in talks:
       
   101         subject = 'SciPy.in 2009: Requesting for confirmation of your talk'
       
   102         message = loader.render_to_string(
       
   103             template, dictionary={'name': talk.speaker.username,
       
   104                                   'title': talk.title})
       
   105 
       
   106         talk.speaker.email_user(subject=subject, message=message,
       
   107                                 from_email='admin@scipy.in')