【发布时间】:2016-02-17 21:18:10
【问题描述】:
我正在尝试修改 django-registration 中的密码表格以包含超链接。我对activation_email.html 使用了完全相同的代码,但它不适用于password_reset_email.html。生成的电子邮件正在打印所有 html 标签,如 。我错过了什么?
下面是password_reset_email.html的代码:
{% load i18n %}
<!doctype html>
<html lang="en">
{% blocktrans %}Hello,{% endblocktrans %}
{% blocktrans %}
To reset your password, please click the following link:
{% endblocktrans %}
<body>
<p>
<a href="http://{{site.domain}}{% url 'auth_password_reset_confirm' uid token %}">
Reset password
</a>
</p>
</body>
{% blocktrans %}
If you do not wish to reset your password, please ignore this message.
{% endblocktrans %}
{% blocktrans %}Thanks,{% endblocktrans %}
{% blocktrans %}Management Team{% endblocktrans %}
{# This is used by django.contrib.auth #}
这里是用于比较的activation_email.html 的代码。这会产生正确的结果。
{% load i18n %}
<!doctype html>
<html lang="en">
<head>
<title>{{ site.name }} {% trans "registration" %}</title>
</head>
<body>
<p>
{% blocktrans with site_name=site.name %}
Hello!
</p>
<p>
We're ready to activate your account. All we need to do is make sure this is your email address.
{% endblocktrans %}
</p>
<p>
<a href="http://{{site.domain}}{% url 'registration_activate' activation_key %}">
Confirm email
</a>
</p>
<p>
{% blocktrans %}
If you didn't create a account, please just delete this email.
{% endblocktrans %}
</p>
</body>
</html>
【问题讨论】:
标签: python html django django-forms