blob: a7f6075a23114a156232dad2176ec93ac6b76626 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
"""Helper script to send emails to the users.
"""
__authors__ = [
'"Madhusudan.C.S" <madhusudancs@gmail.com>',
]
from django.template import loader
from django.contrib.auth.models import User
from django.utils.translation import ugettext
def textbook_workshop_remainder(subject_template=None, body_template=None):
"""Sends a mail to each delegate about the template content specified.
"""
users = User.objects.all()
subject = loader.render_to_string(subject_template).strip(' \n\t')
for user in users:
profile = user.get_profile()
if profile:
full_name = profile.full_name
else:
full_name = ''
message = loader.render_to_string(
body_template, dictionary={'name': full_name})
user.email_user(subject=subject, message=message,
from_email='madhusudancs@fossee.in')
|