scripts/scipy_migrate.py
changeset 1 fda1c66b25f9
child 21 127b772a3af4
equal deleted inserted replaced
0:9a77edda77b7 1:fda1c66b25f9
       
     1 """Helper script to send an email to all users who registered
       
     2 before activation logic was implemented. This script can be 
       
     3 run only within a Django shell.
       
     4 """
       
     5 
       
     6 
       
     7 __authors__ = [
       
     8   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
       
     9   ]
       
    10 
       
    11 
       
    12 from datetime import datetime
       
    13 
       
    14 from django.template import loader
       
    15 
       
    16 from registration.models import RegistrationProfile
       
    17 
       
    18 
       
    19 def remind_users():
       
    20     regs = RegistrationProfile.objects.filter(
       
    21         user__is_active=0,
       
    22         user__date_joined__lte=datetime(2009, 10, 13))
       
    23 
       
    24     template = 'notifications/activate_mail.html'
       
    25 
       
    26     for reg in regs:
       
    27 
       
    28         subject = "Update and activate your SciPy.in registration."
       
    29         message = loader.render_to_string(template, dictionary={'activation_key': reg.activation_key})
       
    30 
       
    31         reg.user.email_user(subject=subject, message=message)
       
    32