It resolved.

I used "Template" in Database.
It was the cause.
It was a simple mistake.


Thank you.


2014年11月5日水曜日 11時25分27秒 UTC+9 Nakaya Mitsuo:
>
> I got AttributeError.
> Exception Value: 'Template' object has no attribute 'render'
>
> How can I fix it?
> Please help me.
>
> ------- CODE ------
>
> 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:
>            pass
>        else:
>            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.subject
>                send_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_name
>                    message = 
> render_to_string('txt/change_email.txt',send_mail_dict)
>                    send_mail(subject, message, 
> settings.DEFAULT_FROM_EMAIL, [auth_user.email])
>                except:
>                    pass
>        return 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 [email protected].
To post to this group, send email to [email protected].
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/3627d0c9-b046-4e7a-a9c9-6910ed5fd5b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to