scripts/scipy_migrate.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Thu, 05 Nov 2009 14:20:58 +0530
changeset 13 1de2f4008a5d
parent 1 fda1c66b25f9
child 21 127b772a3af4
permissions -rw-r--r--
Forgot to add home.html in previous commit. Adding it now.

"""Helper script to send an email to all users who registered
before activation logic was implemented. This script can be 
run only within a Django shell.
"""


__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
  ]


from datetime import datetime

from django.template import loader

from registration.models import RegistrationProfile


def remind_users():
    regs = RegistrationProfile.objects.filter(
        user__is_active=0,
        user__date_joined__lte=datetime(2009, 10, 13))

    template = 'notifications/activate_mail.html'

    for reg in regs:

        subject = "Update and activate your SciPy.in registration."
        message = loader.render_to_string(template, dictionary={'activation_key': reg.activation_key})

        reg.user.email_user(subject=subject, message=message)