ubernostrum / django-registration

An extensible user-registration app for Django.
BSD 3-Clause "New" or "Revised" License
923 stars 241 forks source link

No rendering in email template #240

Closed CyberFox001 closed 1 year ago

CyberFox001 commented 1 year ago

On a website, I installed and configured django-registration with 2 steps registration.

On the e-mail sent by the app, the context variables are not rendered. For the subject and the body.

Example of subject template:

{% load i18n %}{% blocktranslate %}Account activation for {{ user.username }} on {{ site.name }}{% endblocktranslate %}

Result in the email subject:

Activation du compte  sûr 

Note: The content is translated to french.

Example of body template:

{% load i18n %}
{% blocktranslate %}
Welcome on {{ site.name }}.

An account with the user name {{ user.username }} has been created on {{ site.name }}.

To activate your account, please follow this link:
{% endblocktranslate %}
{{ scheme }}://{{ site.domain }}{% url 'django_registration_activate' activation_key %}
{% blocktranslate %}

You have {{ expiration_days }} days before the expiration of this activation link.

Best regards.

{% endblocktranslate %}

Result in the email body:

Bienvenu sur .

Un compte avec le nom  a été créé sur  .

Pour activer votre compte, veuillez suivre ce lien:

https://example.com/accounts/activate/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/

Vous avez 7 jours avant l'expiration de ce lien d'activation .

Meilleures salutiations.

The website feature is installed and the website configured with name and domain.

django-registration version: 3.3 Django version: 4.1.10

ubernostrum commented 1 year ago

This is not a bug in django-registration. In order to use expressions like site.name or user.username inside blocktranslate, you must "bind" those expressions in the blocktranslate tag. Please refer to the Django documentation for blocktranslate for details.

CyberFox001 commented 1 year ago

Noted. Thanks.