I got AttributeError.
Exception Value: 'Template' object has no attribute 'render'
How can I fix it?
Please help me.
------- CODE ------
from django.shortcuts import renderfrom django.template import Context, Templateclass US_AccountManager(models.Manager):def update_account(self, auth_user, email):us_profile = auth_user.us_profileif auth_user.email == email:passelse:try:mail_template = Mail_Template.objects.get(position = 'MC')context = Context({'site_root':site_root,'app_name':app_name})message = Template(mail_template.message).render(context)subject = mail_template.subjectsend_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [auth_user.email])except Mail_Template.DoesNotExist:try:send_mail_dict = {'site_root':site_root,'app_name':app_name}subject = 'From' + app_namemessage = render_to_string('txt/change_email.txt',send_mail_dict)send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [auth_user.email])except:passreturn auth_user
I want to send mail from template ( contain in database ).
And render the template.
Sorry my poor English.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/75041768-887a-4b21-8514-472511a9c075%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment