【发布时间】:2020-05-29 05:29:51
【问题描述】:
类似于这个问题 How to customize django rest auth password reset email content/template 我想自定义由 django rest auth 自动发送的密码重置(和其他)电子邮件。使用带有自定义序列化程序的自定义电子邮件模板非常有效:
class CustomPasswordResetSerializer(PasswordResetSerializer):
def get_email_options(self):
return {
'domain_override': settings.FRONTEND_URL,
'email_template_name': 'registration/custom_reset_email.txt',
'html_email_template_name': 'registration/custom_reset_email.html',
}
但除了自定义模板之外,我还想添加自定义 context。有简单的方法吗?
【问题讨论】: