project/kiwipycon/registration/utils.py
changeset 1 fda1c66b25f9
child 19 fe95eee8ca3c
equal deleted inserted replaced
0:9a77edda77b7 1:fda1c66b25f9
       
     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 Kiwi Pycon 2009. You may log in to 
       
   110 http://nz.pycon.org/login using the following credentials:
       
   111 
       
   112 Username: %(username)s
       
   113 Password: %(password)s
       
   114 
       
   115 Amount: %(amount)s
       
   116 
       
   117 Your invoice number is: %(invoice)s
       
   118 
       
   119 Please use this number and your username as reference when 
       
   120 making payment to the following:
       
   121 
       
   122 New Zealand Python User Group,
       
   123 06-0158-0360348-00
       
   124 The National Bank,
       
   125 Auckland University Branch
       
   126 PO Box 2132
       
   127 
       
   128 Thanks for your registration!
       
   129 
       
   130 You can view your invoice at:
       
   131 http://nz.pycon.org/invoice
       
   132 And a pdf version here:
       
   133 http://nz.pycon.org/pdf_invoice
       
   134 
       
   135 Regards,
       
   136 The Kiwi Pycon 2009 Team
       
   137 
       
   138 If you lose your password to the website please visit:
       
   139 http://nz.pycon.org/password-reset
       
   140 
       
   141     """
       
   142 
       
   143 confirmation_sponsoreduser = """
       
   144 Dear %(name)s,
       
   145 
       
   146 Welcome to Kiwi Pycon 2009.
       
   147 
       
   148 Your username is: %(username)s
       
   149 
       
   150 Your registration has been accepted as a guest of %(stype)s 
       
   151 sponsor %(sname)s.
       
   152 
       
   153 Thanks!
       
   154 
       
   155 Regards,
       
   156 The Kiwi Pycon 2009 Team
       
   157 
       
   158 If you have lost your password to the website please visit:
       
   159 http://nz.pycon.org/password-reset
       
   160 
       
   161     """
       
   162 
       
   163 confirmation_sponsorednewuser = """
       
   164 Dear %(name)s,
       
   165 
       
   166 Welcome to Kiwi Pycon 2009.
       
   167 
       
   168 Your username is: %(username)s
       
   169 Your password is: %(password)s
       
   170 
       
   171 Your registration has been accepted as a guest of %(stype)s sponsor %(sname)s.
       
   172 
       
   173 Thanks!
       
   174 
       
   175 Regards,
       
   176 The Kiwi Pycon 2009 Team
       
   177 
       
   178 If you lose your password to the website please visit:
       
   179 http://nz.pycon.org/password-reset
       
   180 
       
   181     """
       
   182 
       
   183 confirmation_currentuser = """
       
   184 Dear %(name)s,
       
   185 
       
   186 Welcome to Kiwi Pycon 2009.
       
   187 
       
   188 Your invoice number is: %(invoice)s
       
   189 Your username is: %(username)s
       
   190 
       
   191 Amount: %(amount)s
       
   192 
       
   193 Please use this number and your username as reference when making payment
       
   194 to the following:
       
   195 
       
   196 New Zealand Python User Group,
       
   197 06-0158-0360348-00
       
   198 The National Bank,
       
   199 Auckland University Branch
       
   200 PO Box 2132
       
   201 
       
   202 Thanks for your registration!
       
   203 
       
   204 You can view your invoice at:
       
   205 http://nz.pycon.org/invoice 
       
   206 And a pdf version here:
       
   207 http://nz.pycon.org/pdf_invoice
       
   208 
       
   209 Regards,
       
   210 The Kiwi Pycon 2009 Team
       
   211 
       
   212 If you have lost your password to the website please visit:
       
   213 http://nz.pycon.org/password-reset
       
   214 
       
   215     """