繁体   English   中英

Cookiecutter django编辑电子邮件

[英]cookiecutter django edit email

因此,我正在使用cookiecutter-django ,它具有django-allauth用于用户注册,而django-anymail作为发送电子邮件的后端。 我想自定义在用户注册或忘记密码时发送给用户的电子邮件。 我似乎在我的cookiecutter-django项目中找不到代码,似乎它是从我的应用程序外部的模板(可能在anymail模块中)完成的,所以我不知道我应该在哪里或如何编写自定义电子邮件信息。 另外,由于注册模板在我的项目中没有视图,因此无法找到调试器。 这是调用注册模板的网址代码:

<li class="nav-item mx-md-3">
    <a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}"><i class="fa fa-user-plus"></i> {% trans "Sign Up" %}</a>
</li>

这是我的项目中的URL配置:

# User management
url(r'^users/', include('solucionesverdesweb.users.urls', namespace='users')),
url(r'^accounts/', include('allauth.urls')),

在这里找到这个

要自定义发送的电子邮件,请复制以下文件(在python site-packages目录中):

site-packages/allauth/templates/account/email/email_confirmation_message.txt
site-packages/allauth/templates/account/email/email_confirmation_subject.txt

到应用程序的模板目录:

your-app/templates/account/email/email_confirmation_message.txt
your-app/templates/account/email/email_confirmation_subject.txt

并对您的本地副本进行任何更改。

(如果我了解您的要求)

在您的urls.py中,您可以使用类似以下的内容: https : //docs.djangoproject.com/en/1.10/topics/auth/default/#module-django.contrib.auth.views

url(r'^password_reset/$',
    auth_views.password_reset,
    {'current_app': 'accounts',
     'template_name': 'accounts/password_reset.html',
     'email_template_name': 'accounts/password_reset_email.html',
     'password_reset_form': MyPasswordResetForm,
     'post_reset_redirect': '/accounts/password_reset_done/', },
    name='password_reset'),

您可以检查Django代码上的所有可用选项: https : //github.com/django/django/blob/master/django/contrib/auth/views.py#L214

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM