6

forgot_passwordカスタムテンプレートでDjangoフレームワークを使用しています。私はを使用してDjango 1.5います。私のカスタムテンプレートpassword_reset_email.htmlは次のようになります。

{% autoescape off %}
You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.

Please go to the following page and choose a new password:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %}
{% endblock %}

Your username, in case you've forgotten: {{ user.username }}

Thanks for using our site!

The {{ site_name }} team.

{% endautoescape %}

#Exception:
Exception Type: TemplateSyntaxError at /accounts/password/reset/
Exception Value: Could not parse the remainder: ',' from 'uid,'
4

2 に答える 2

16

これを一番上に置きます:

 {% load i18n %}{% load url from future %}
 {% autoescape off %}
 ..........

削除,し、横に置きますuidb36=uid,

 {% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}
于 2013-03-27T08:32:50.390 に答える
11

受け入れられた回答についてコメントするのに十分なレピュテーションポイントがありませんが、Django 1.5を使用しているため、{%load url from future%}は必要ありません。Django1.3と1.4でのみ必要でした。 https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi

于 2013-04-04T21:45:45.363 に答える