I got AttributeError.
Please help me.
from django.shortcuts import render
from django.template import Context, Template
class US_AccountManager(models.Manager):
def update_account(self, auth_user, email):
us_profile = auth_user.us_profile
if auth_user.email == email:
mail_template = Mail_Template.objects.get(position = 'MC')
context = Context({'site_root':site_root,
message = Template(mail_template.message).render(context)
subject = mail_template.subject
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [auth_user.email])
except Mail_Template.DoesNotExist:
send_mail_dict = {'site_root':site_root,
subject = 'From' + app_name
message = render_to_string('txt/change_email.txt',send_mail_dict)
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [auth_user.email])
I want to send mail from template ( contain in database ).
And render the template.
Sorry my poor English.