scripts/mails.py
branch2011
changeset 389 fe49720e67bf
parent 359 9640495f5097
equal deleted inserted replaced
385:0e1fcd57f95d 389:fe49720e67bf
    15 from project.scipycon.registration.models import Registration
    15 from project.scipycon.registration.models import Registration
    16 from project.scipycon.talk.models import Talk
    16 from project.scipycon.talk.models import Talk
    17 
    17 
    18 
    18 
    19 DEF_REMAINDER_REGISTRATION_PAGE_SUBJECT = ugettext(
    19 DEF_REMAINDER_REGISTRATION_PAGE_SUBJECT = ugettext(
    20   'SciPy.in 2010: Registration updates required for confirmation')
    20   'SciPy.in 2011: Registration updates required for confirmation')
    21 
    21 
    22 DEF_REMAINDER_ACCO_CONTACT_SUBJECT = ugettext(
    22 DEF_REMAINDER_ACCO_CONTACT_SUBJECT = ugettext(
    23    'SciPy.in 2010: Contact details, registration page and other updates')
    23    'SciPy.in 2011: Contact details, registration page and other updates')
    24 
    24 
    25 
    25 
    26 def speaker_accepted():
    26 def speaker_accepted():
    27     """Sends a mail to each speaker whose talk has been accepted
    27     """Sends a mail to each speaker whose talk has been accepted
    28     informing them about the same.
    28     informing them about the same.
    31     talks = Talk.objects.all()
    31     talks = Talk.objects.all()
    32 
    32 
    33     template = 'notifications/speaker_accepted_mail.html'
    33     template = 'notifications/speaker_accepted_mail.html'
    34 
    34 
    35     for talk in talks:
    35     for talk in talks:
    36         subject = 'Your talk has been selected for SciPy.in 2010!'
    36         subject = 'Your talk has been selected for SciPy.in 2011!'
    37         message = loader.render_to_string(
    37         message = loader.render_to_string(
    38             template, dictionary={'name': talk.speaker.username,
    38             template, dictionary={'name': talk.speaker.username,
    39                                   'title': talk.title})
    39                                   'title': talk.title})
    40 
    40 
    41         talk.speaker.email_user(subject=subject, message=message,
    41         talk.speaker.email_user(subject=subject, message=message,
    50     talks = Talk.objects.all()
    50     talks = Talk.objects.all()
    51 
    51 
    52     template = 'notifications/speaker_sponsorship_mail.html'
    52     template = 'notifications/speaker_sponsorship_mail.html'
    53 
    53 
    54     for talk in talks:
    54     for talk in talks:
    55         subject = 'Details regarding your travel and accommodation for SciPy.in 2010'
    55         subject = 'Details regarding your travel and accommodation for SciPy.in 2011'
    56         message = loader.render_to_string(
    56         message = loader.render_to_string(
    57             template, dictionary={'name': talk.speaker.username,
    57             template, dictionary={'name': talk.speaker.username,
    58                                   'title': talk.title})
    58                                   'title': talk.title})
    59 
    59 
    60         talk.speaker.email_user(subject=subject, message=message,
    60         talk.speaker.email_user(subject=subject, message=message,
    84     regs = Registration.objects.all()
    84     regs = Registration.objects.all()
    85 
    85 
    86     template = 'notifications/sprints_about_mail.html'
    86     template = 'notifications/sprints_about_mail.html'
    87 
    87 
    88     for reg in regs:
    88     for reg in regs:
    89         subject = 'SciPy.in 2010: Details of the individual events'
    89         subject = 'SciPy.in 2011: Details of the individual events'
    90         message = loader.render_to_string(
    90         message = loader.render_to_string(
    91             template, dictionary={'name': reg.registrant.username})
    91             template, dictionary={'name': reg.registrant.username})
    92 
    92 
    93         reg.registrant.email_user(subject=subject, message=message,
    93         reg.registrant.email_user(subject=subject, message=message,
    94                                   from_email='madhusudancs@gmail.com')
    94                                   from_email='madhusudancs@gmail.com')
   102     regs = Registration.objects.all()
   102     regs = Registration.objects.all()
   103 
   103 
   104     template = 'notifications/last_day_mail.html'
   104     template = 'notifications/last_day_mail.html'
   105 
   105 
   106     for reg in regs:
   106     for reg in regs:
   107         subject = 'SciPy.in 2010: Schedule and other details'
   107         subject = 'SciPy.in 2011: Schedule and other details'
   108         message = loader.render_to_string(
   108         message = loader.render_to_string(
   109             template, dictionary={'name': reg.registrant.username})
   109             template, dictionary={'name': reg.registrant.username})
   110 
   110 
   111         reg.registrant.email_user(subject=subject, message=message,
   111         reg.registrant.email_user(subject=subject, message=message,
   112                                   from_email='madhusudancs@gmail.com')
   112                                   from_email='madhusudancs@gmail.com')
   119     talks = Talk.objects.all()
   119     talks = Talk.objects.all()
   120 
   120 
   121     template = 'notifications/speaker_confirmation_mail.html'
   121     template = 'notifications/speaker_confirmation_mail.html'
   122 
   122 
   123     for talk in talks:
   123     for talk in talks:
   124         subject = 'SciPy.in 2010: Requesting for confirmation of your talk'
   124         subject = 'SciPy.in 2011: Requesting for confirmation of your talk'
   125         message = loader.render_to_string(
   125         message = loader.render_to_string(
   126             template, dictionary={'name': talk.speaker.username,
   126             template, dictionary={'name': talk.speaker.username,
   127                                   'title': talk.title})
   127                                   'title': talk.title})
   128 
   128 
   129         talk.speaker.email_user(subject=subject, message=message,
   129         talk.speaker.email_user(subject=subject, message=message,
   136     talks = Talk.objects.all()
   136     talks = Talk.objects.all()
   137 
   137 
   138     template = 'notifications/proceedings_detail_mail.html'
   138     template = 'notifications/proceedings_detail_mail.html'
   139 
   139 
   140     for talk in talks:
   140     for talk in talks:
   141         subject = 'SciPy.in 2010 Proceedings'
   141         subject = 'SciPy.in 2011 Proceedings'
   142         message = loader.render_to_string(
   142         message = loader.render_to_string(
   143             template, dictionary={'name': talk.speaker.username})
   143             template, dictionary={'name': talk.speaker.username})
   144 
   144 
   145         talk.speaker.email_user(subject=subject, message=message,
   145         talk.speaker.email_user(subject=subject, message=message,
   146                                 from_email='admin@scipy.in')
   146                                 from_email='admin@scipy.in')