scripts/mails.py
changeset 359 9640495f5097
parent 284 291f4bb93888
child 389 fe49720e67bf
equal deleted inserted replaced
358:c09beee32d9b 359:9640495f5097
     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 from django.contrib.auth.models import User
       
    13 from django.utils.translation import ugettext
    13 
    14 
    14 from project.scipycon.registration.models import Registration
    15 from project.scipycon.registration.models import Registration
    15 from project.scipycon.talk.models import Talk
    16 from project.scipycon.talk.models import Talk
       
    17 
       
    18 
       
    19 DEF_REMAINDER_REGISTRATION_PAGE_SUBJECT = ugettext(
       
    20   'SciPy.in 2010: Registration updates required for confirmation')
       
    21 
       
    22 DEF_REMAINDER_ACCO_CONTACT_SUBJECT = ugettext(
       
    23    'SciPy.in 2010: Contact details, registration page and other updates')
    16 
    24 
    17 
    25 
    18 def speaker_accepted():
    26 def speaker_accepted():
    19     """Sends a mail to each speaker whose talk has been accepted
    27     """Sends a mail to each speaker whose talk has been accepted
    20     informing them about the same.
    28     informing them about the same.
    58     """
    66     """
    59 
    67 
    60     regs = Registration.objects.all()
    68     regs = Registration.objects.all()
    61 
    69 
    62     for reg in regs:
    70     for reg in regs:
    63         subject = 'SciPy.in 2010: Registration updates required for confirmation'
    71         subject = DEF_REMAINDER_ACCO_CONTACT_SUBJECT
    64         message = loader.render_to_string(
    72         message = loader.render_to_string(
    65             template, dictionary={'name': reg.registrant.get_full_name()})
    73             template, dictionary={'name': reg.registrant.get_full_name()})
    66 
    74 
    67         reg.registrant.email_user(subject=subject, message=message,
    75         reg.registrant.email_user(subject=subject, message=message,
    68                                   from_email='info@scipy.in')
    76                                   from_email='info@scipy.in')