重写Django模板将引发TemplateSyntaxError

2024-09-30 18:30:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图通过在templates/registration/password_reset_email.html中添加此文件来重置django应用程序中的密码\u reset\u email.html模板:

{% load i18n %}{% autoescape off %}
{% blocktranslate %}You're receiving this email because you requested a password reset for your user account.{% endblocktranslate %}

{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }}

{% translate "Thanks for using our app!" %}

{% blocktranslate %}The team{% endblocktranslate %}

{% endautoescape %}

但是,它会引发TemplateSyntaxError:

'blocktranslate', expected 'endautoescape'. Did you forget to register or load this tag?

我做错了什么


Tags: totokenyouforemailhtmlusernameload