project/scipycon/registration/utils.py
changeset 94 87e77aa18610
child 146 e23e937ddcda
equal deleted inserted replaced
93:e86755df35da 94:87e77aa18610
       
     1 # -*- coding: utf-8 -*-
       
     2 from __future__ import absolute_import
       
     3 
       
     4 # django
       
     5 from django.core.mail import EmailMessage
       
     6 
       
     7 def send_confirmation(registrant, invoice, password=None, sponsor=None,
       
     8         amount=None):
       
     9 
       
    10     message = EmailMessage()
       
    11     message.subject = u'Registration to SciPy.in 2009'
       
    12     message.from_email = u'admin@scipy.in'
       
    13     message.to = [registrant.email]
       
    14     name = '%s %s' % (registrant.first_name, registrant.last_name)
       
    15     if name.strip() == '':
       
    16         name = registrant.username
       
    17 
       
    18     username = registrant.username
       
    19     all = {'name': name,
       
    20             'password': password,
       
    21             'username': username}
       
    22 
       
    23     if password:
       
    24         message.body = confirmation_newuser % all
       
    25     else:
       
    26         message.body = confirmation_currentuser % all
       
    27 
       
    28     message.send()
       
    29 
       
    30 def send_confirmation_payment_email(registrant):
       
    31     message = EmailMessage()
       
    32     message.subject = u'Registration payment to SciPy.in 2009'
       
    33     message.from_email = u'admin@scipy.in'
       
    34     message.to = [registrant.email]
       
    35     name = '%s %s' % (registrant.first_name, registrant.last_name)
       
    36     username = registrant.username
       
    37     if name.strip() == '':
       
    38         name = registrant.username
       
    39     message.body = confirmation_payment % dict(name=name,
       
    40             username=username)
       
    41     message.send()
       
    42 
       
    43 def send_banking_fix_email(registrant, invoicenum):
       
    44     message = EmailMessage()
       
    45     message.subject = u'Registration invoice update to SciPy.in 2009'
       
    46     message.from_email = u'admin@scipy.in'
       
    47     message.to = [registrant.email]
       
    48     name = '%s %s' % (registrant.first_name, registrant.last_name)
       
    49     username = registrant.username
       
    50     if name.strip() == '':
       
    51         name = registrant.username
       
    52     message.body = banking_fix % dict(name=name,
       
    53             username=username, invoice=invoicenum)
       
    54     message.send()
       
    55 
       
    56 banking_fix = """
       
    57 Dear %(name)s,
       
    58 
       
    59 Invoice update to Kiwi Pycon 2009.
       
    60 
       
    61 Ooops. We made the invoice number too long to be entered for internet banking.
       
    62 We have therefore changed the prefix and your new invoice number is:
       
    63 %(invoice)s
       
    64 
       
    65 You will find that your online invoice has been updated. Thanks for your
       
    66 patience.
       
    67 
       
    68 http://nz.pycon.org/invoice
       
    69 A pdf version here:
       
    70 http://nz.pycon.org/pdf_invoice
       
    71 
       
    72 Regards,
       
    73 The Kiwi Pycon 2009 Team
       
    74 
       
    75 Your username, in case you've forgotten: %(username)s.
       
    76 
       
    77 If you have lost your password to the website please visit:
       
    78 http://nz.pycon.org/password-reset
       
    79 
       
    80     """
       
    81 
       
    82 confirmation_payment = """
       
    83 Dear %(name)s,
       
    84 
       
    85 Welcome to Kiwi Pycon 2009.
       
    86 
       
    87 Your payment has been received and your attendence confirmed.
       
    88 
       
    89 Many thanks!
       
    90 
       
    91 You can view your invoice at:
       
    92 http://nz.pycon.org/invoice
       
    93 And a pdf version here:
       
    94 http://nz.pycon.org/pdf_invoice
       
    95 
       
    96 Regards,
       
    97 The Kiwi Pycon 2009 Team
       
    98 
       
    99 Your username, in case you've forgotten: %(username)s.
       
   100 
       
   101 If you have lost your password to the website please visit:
       
   102 http://nz.pycon.org/password-reset
       
   103 
       
   104     """
       
   105 
       
   106 confirmation_newuser = """
       
   107 Dear %(name)s,
       
   108 
       
   109 Welcome to SciPy.in 2009. You may log in to 
       
   110 http://scipy.in/login using the following credentials:
       
   111 
       
   112 Username: %(username)s
       
   113 Password: %(password)s
       
   114 
       
   115 There is an entry fee for the SciPy conference only. However
       
   116 the sprint and tutorials don't have any entry fee. The entry
       
   117 fee for the conference can be paid on the spot on the first
       
   118 day of the conference.
       
   119 
       
   120 Thanks for your registration!
       
   121 
       
   122 Regards,
       
   123 The SciPy.in Team
       
   124 
       
   125 If you lose your password to the website please visit:
       
   126 http://scipy.in/password-reset
       
   127     """
       
   128 
       
   129 confirmation_sponsoreduser = """
       
   130 Dear %(name)s,
       
   131 
       
   132 Welcome to Kiwi Pycon 2009.
       
   133 
       
   134 Your username is: %(username)s
       
   135 
       
   136 Your registration has been accepted as a guest of %(stype)s 
       
   137 sponsor %(sname)s.
       
   138 
       
   139 Thanks!
       
   140 
       
   141 Regards,
       
   142 The Kiwi Pycon 2009 Team
       
   143 
       
   144 If you have lost your password to the website please visit:
       
   145 http://nz.pycon.org/password-reset
       
   146 
       
   147     """
       
   148 
       
   149 confirmation_sponsorednewuser = """
       
   150 Dear %(name)s,
       
   151 
       
   152 Welcome to Kiwi Pycon 2009.
       
   153 
       
   154 Your username is: %(username)s
       
   155 Your password is: %(password)s
       
   156 
       
   157 Your registration has been accepted as a guest of %(stype)s sponsor %(sname)s.
       
   158 
       
   159 Thanks!
       
   160 
       
   161 Regards,
       
   162 The Kiwi Pycon 2009 Team
       
   163 
       
   164 If you lose your password to the website please visit:
       
   165 http://nz.pycon.org/password-reset
       
   166 
       
   167     """
       
   168 
       
   169 confirmation_currentuser = """
       
   170 Dear %(name)s,
       
   171 
       
   172 Welcome to SciPy.in 2009. You may log in to 
       
   173 http://scipy.in/login using the following credentials:
       
   174 
       
   175 Username: %(username)s
       
   176 Password: %(password)s
       
   177 
       
   178 There is an entry fee for the SciPy conference only. However
       
   179 the sprint and tutorials don't have any entry fee. The entry
       
   180 fee for the conference can be paid on the spot on the first
       
   181 day of the conference. 
       
   182 
       
   183 Thanks for your registration!
       
   184 
       
   185 Regards,
       
   186 The SciPy.in Team
       
   187 
       
   188 If you lose your password to the website please visit:
       
   189 http://scipy.in/password-reset
       
   190     """