你好,我正在尝试覆盖Django allauth的password_reset_email。问题是虽然它成功地被覆盖了,但我收到的是发送给用户的html代码而不是html表示形式。
我原本期望得到一个像我收到的确认邮件那样有样式的电子邮件,但情况似乎并非如此。
在我的templates/registration/password_reset_email.html
中。
{% load i18n %}
{% autoescape off %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Confirm Your E-mail</title>
<style>
.body {
background-color: #f6f6f6;
padding: 30px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.content {
background-color: #FFFFFF;
color: #4d4d4d;
max-width: 400px;
padding: 20px;
margin: auto;
}
.title {
font-size: 20px;
font-weight: 600;
margin: 10px 0;
text-align: center
}
.intro {
font-size: 15px;
align-self: flex-start;
color: #4d4d4d;
margin-bottom: 15px;
}
.main-body {
font-size: 15px;
color: #4d4d4d;
margin-bottom: 15px;
}
.alt-body {
width: 100%;
display: flex;
flex-direction: row !important;
justify-content: center !important;
}
.alt-body>a {
font-size: 17px;
font-weight: 500;
text-decoration: none;
color: #FFFFFF;
margin: auto;
margin-bottom: 15px;
}
.cta-button {
background-color: #525659;
padding: 9px 100px;
border: 2px solid #525659;
border-radius: 35px;
align-self: center;
}
.cta-button:hover {
background-color: #000000;
border: 2px solid #000000;
}
.sub-body {
font-size: 15px;
color: #4d4d4d;
margin-bottom: 15px;
margin-top: 0;
align-self: flex-start;
}
.sub-body a {
text-decoration: none;
color: #4d4d4d;
font-size: 15px;
}
.sub-body a:hover {
text-decoration: none;
color: #4d4d4d;
}
.outro {
margin: 20px 0;
}
.outro > p {
font-size: 15px;
margin-top: 3px;
margin-bottom: 3px;
}
.outro a {
text-decoration: none;
color: #4d4d4d;
font-size: 15px;
margin-top: 3px;
margin-bottom: 3px;
}
.outro a:hover {
text-decoration: none;
color: #4d4d4d;
}
</style>
</head>
<body class="body">
<div class="content">
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<p class="title">Email Verification</p>
<p class="intro">Hello there,</p>
<p class="main-body">
Simply click on the button to verify your cre8ive-mart email.
</p>
<div class="alt-body">
<a href="{{ activate_url }}" class="cta-button">Verify Email</a>
</div>
<p class="sub-body">
if you have any questions, please contact <a href="mailto:todoetester@gmail.com">todoetester@gmail.com</a>
</p>
<div class="outro">
<p class="outro-greeting">Sincerely,</p>
<p class="outro-main">cre8ive-mart</p>
<a href="#" class="outro-website">cre8ivemart.com</a>
</div>
{% endblocktrans %}
</div>
</body>
</html>
{% endautoescape %}
但我收到的电子邮件是这样的:
我只是收到了HTML表示,而不是已经应用了样式的组件。