我正在覆盖password_reset_email模板。 我收到一封电子邮件,其中包含带有参数渲染的新模板。 我的问题是html标签未呈现(我在电子邮件中看到并
)
什么会导致此类问题? 我正在使用Django 1.6
编辑:这是代码:
def token_reset(request, is_admin_site=False,
template_name='two_factor/token_reset_form.html',
email_template_name='two_factor/token_reset_email.html',
subject_template_name='two_factor/token_reset_subject.txt',
password_reset_form=LoginTokenResetForm,
token_generator=default_token_generator,
post_reset_redirect=None,
from_email=None,
current_app=None,
extra_context=None):
if post_reset_redirect is None:
post_reset_redirect = reverse('token_reset_done')
else:
post_reset_redirect = resolve_url(post_reset_redirect)
form = None
if request.method == "POST":
form = password_reset_form(request=request)
if form.is_valid():
opts = {
'use_https': request.is_secure(),
'token_generator': token_generator,
'from_email': from_email,
'email_template_name': email_template_name,
'subject_template_name': subject_template_name,
'request': request,
}
if is_admin_site:
opts = dict(opts, domain_override=request.get_host())
form.save(**opts)
return HttpResponseRedirect(post_reset_redirect)
context = {
'form': form,
}
if extra_context is not None:
context.update(extra_context)
return TemplateResponse(request, template_name, context,
current_app=current_app)
这是我从电子邮件中获得的信息:
您收到此电子邮件是因为您在mycompany.com上请求重置用户帐户的令牌。
<p>Clicking this link will reset your token:</p> <p>example.com/signin/reset/token/confirm/MTMyOA-4yy-f567c21e89d469b8af06/</p> <p>Your username, in case you've forgotten: naama@imycompany.com</p> <p>We are happy to assist you with any question you might have at support@mycompany.com</p>
谢谢