chrisRubiano
chrisRubiano

Reputation: 39

cookiecutter django edit email

So I'm using cookiecutter-django, which has django-allauth for user registration and django-anymail as a backend for sending email. I want to customize the emails that are being sent to the users when they sign up or forget their passwords. I can't seem to find the code in my cookiecutter-django project, it seems like its done from a template from outside my app (maybe in anymail module), so I don't know where or how should I write a customized email message. Also, since the sign up template doesn't have a view inside my project I can't find my way through the debugger. This is the url code that calls the sign up template:

<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>

And this is the URL configuration inside my project:

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

Upvotes: 0

Views: 762

Answers (2)

amcorreia
amcorreia

Reputation: 1

(If I understood what you are asking)

In your urls.py you can use something like this: 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'),

You can check all the available options on Django code: https://github.com/django/django/blob/master/django/contrib/auth/views.py#L214

Upvotes: 0

Dan S.
Dan S.

Reputation: 162

Found this here

To customize the email that gets sent out, copy these files (in your python site-packages directory):

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

to your application’s templates directory:

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

And make any changes you like to your local copies.

Upvotes: 5

Related Questions