定制django allauth模板
主要是试图修改allauth文档之后在注册时发送的电子邮件验证。当我更改email_confirmation_message.txt时,发送的电子邮件会被修改,但当我想使用html表示时,文档中说使用email_confirmation_message.html,但它无法识别,而是发送默认的电子邮件电子邮件,或者如果我包括这两个,它只会删除文本,而忽略html 电子邮件\u确认\u message.html:定制django allauth模板,django,django-allauth,Django,Django Allauth,主要是试图修改allauth文档之后在注册时发送的电子邮件验证。当我更改email_confirmation_message.txt时,发送的电子邮件会被修改,但当我想使用html表示时,文档中说使用email_confirmation_message.html,但它无法识别,而是发送默认的电子邮件电子邮件,或者如果我包括这两个,它只会删除文本,而忽略html 电子邮件\u确认\u message.html: {% extends "account/email/base_message
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Snippet - GoSNippets</title>
<link href='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css' rel='stylesheet'>
<link href='' rel='stylesheet'>
<script type='text/javascript' src=''></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js'></script>
<script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js'></script>
</head>
<body oncontextmenu='return false' class='snippet-body'>
<div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">We're excited to have you get started on {{ site_domain }}. First, you need to confirm your account. Just press the button below.</p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#FFA73B"><a href={{ activate_url }} target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #FFA73B; display: inline-block;">Confirm Account</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr> <!-- COPY -->
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p>
</td>
</tr> <!-- COPY -->
</table>
<script type='text/javascript'></script>
</body>
</html>
{% endblocktrans %}{% endautoescape %}{% endblock %}
{%extends“account/email/base_message.txt”%}
{%load account%}
{%load i18n%}
{%block content%}{%autoescape off%}{%user\u显示用户为user\u display%}{%blocktrans,站点名称=当前站点名称站点名称站点域=当前站点名称域%}
代码片段-GoSNippets
你能来我们很高兴!准备好进入你的新帐户。
我们很高兴您能开始使用{{site\u domain}。首先,您需要确认您的帐户。只需按下下面的按钮
如果不起作用,请在浏览器中复制并粘贴以下链接:
{%endblocktrans%}{%endautoescape%}{%endblock%}
好的,我想出来了。您还必须更改电子邮件\u确认\u注册\u message.txt
要通过电子邮件发送确认信息,请将
{%include“account/email/email\u confirmation\u message.txt”%}更改为{%include”account/email/email\u confirmation\u message.html”%}
这是否回答了您的问题?还要避免在电子邮件中使用所有JavaScript。我仍然不知道如何使电子邮件确认消息.html有效。为什么需要使用{%include“account/EMAIL/EMAIL确认消息.html”%}
?您所需要的只是将模板移动到正确的文件夹中<代码>模板/帐户/电子邮件/电子邮件确认消息.html