tasks.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:teamreporter 作者: agilentia 项目源码 文件源码
def send_survey(survey_pk):
    survey = Survey.objects.get(pk=survey_pk)

    context = Context({'survey': survey,
                       'questions': survey.report.question_set.active()})
    context['SITE_URL'] = settings.SITE_URL
    subject = render_to_string('email/survey_subject.txt', context)

    text = get_template('email/survey.txt')
    html = get_template('email/survey.html')
    text_content = text.render(context)
    html_content = html.render(context)

    survey.user.email_user(subject, text_content, settings.DEFAULT_FROM_EMAIL, html_message=html_content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号