scripts/mails.py
changeset 45 a7cb2566be42
parent 44 c390adb66ba6
child 46 971ba6d7a529
equal deleted inserted replaced
44:c390adb66ba6 45:a7cb2566be42
     9 
     9 
    10 
    10 
    11 from django.template import loader
    11 from django.template import loader
    12 
    12 
    13 from project.kiwipycon.talk.models import Talk
    13 from project.kiwipycon.talk.models import Talk
       
    14 from django.contrib.auth.models import User
    14 
    15 
    15 
    16 
    16 def speaker_accepted():
    17 def speaker_accepted():
    17     """Sends a mail to each speaker whose talk has been accepted
    18     """Sends a mail to each speaker whose talk has been accepted
    18     informing them about the same.
    19     informing them about the same.
    29                                   'title': talk.title})
    30                                   'title': talk.title})
    30 
    31 
    31         talk.speaker.email_user(subject=subject, message=message,
    32         talk.speaker.email_user(subject=subject, message=message,
    32                                 from_email='admin@scipy.in')
    33                                 from_email='admin@scipy.in')
    33 
    34 
       
    35 
    34 def speaker_sponsorship():
    36 def speaker_sponsorship():
    35     """Sends a mail to each speaker whose talk has been accepted
    37     """Sends a mail to each speaker whose talk has been accepted
    36     informing them about the their sponsorship.
    38     informing them about the their sponsorship.
    37     """
    39     """
    38 
    40 
    46             template, dictionary={'name': talk.speaker.username,
    48             template, dictionary={'name': talk.speaker.username,
    47                                   'title': talk.title})
    49                                   'title': talk.title})
    48 
    50 
    49         talk.speaker.email_user(subject=subject, message=message,
    51         talk.speaker.email_user(subject=subject, message=message,
    50                                 from_email='admin@scipy.in')
    52                                 from_email='admin@scipy.in')
       
    53 
       
    54 
       
    55 def delegate_remainder():
       
    56     """Sends a mail to each speaker whose talk has been accepted
       
    57     informing them about the their sponsorship.
       
    58     """
       
    59 
       
    60     regs = User.objects.all()
       
    61 
       
    62     template = 'notifications/remainder_mail.html'
       
    63 
       
    64     for reg in regs:
       
    65         subject = 'SciPy.in 2009: Remainder and details'
       
    66         message = loader.render_to_string(
       
    67             template, dictionary={'name': reg.user.username})
       
    68 
       
    69         reg.user.email_user(subject=subject, message=message,
       
    70                             from_email='admin@scipy.in')