Answer the question
In order to leave comments, you need to log in
How to override the activation_email template in Django?
Good day.
I am developing a website backend using Django and GraphQl (Graphene).
There was a difficulty with using a custom email template that should be sent when registering a new user (activation_email).
Below is the schema code:
import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from graphql_auth.schema import UserQuery, MeQuery
from graphql_auth import mutations
...
from favorite.schema import FavoriteQuery, FavoriteMutation
class AuthMutation(graphene.ObjectType):
register = mutations.Register.Field()
verify_account = mutations.VerifyAccount.Field()
resend_activation_email = mutations.ResendActivationEmail.Field()
send_password_reset_email = mutations.SendPasswordResetEmail.Field()
password_reset = mutations.PasswordReset.Field()
password_change = mutations.PasswordChange.Field()
archive_account = mutations.ArchiveAccount.Field()
delete_account = mutations.DeleteAccount.Field()
update_account = mutations.UpdateAccount.Field()
send_secondary_email_activation = mutations.SendSecondaryEmailActivation.Field()
verify_secondary_email = mutations.VerifySecondaryEmail.Field()
swap_emails = mutations.SwapEmails.Field()
token_auth = mutations.ObtainJSONWebToken.Field()
verify_token = mutations.VerifyToken.Field()
refresh_token = mutations.RefreshToken.Field()
revoke_token = mutations.RevokeToken.Field()
...
...
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
...
Answer the question
In order to leave comments, you need to log in
this is the standard template for the graphql_auth libraryopen the library and see where the templates are, it turns out that you need to put your own in templates/email/activation_email.html, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question