Django模板错误:无法解析剩余部分:','来自'uid',?

pyn*_*ice 6 django forgot-password django-errors

我正在使用Django forgot_password框架与自定义模板.我在用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,'
Run Code Online (Sandbox Code Playgroud)

cat*_*ine 16

把它放在顶部:

 {% load i18n %}{% load url from future %}
 {% autoescape off %}
 ..........
Run Code Online (Sandbox Code Playgroud)

删除,,你把它放在旁边uidb36=uid,

 {% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}
Run Code Online (Sandbox Code Playgroud)


Der*_*rek 11

我没有足够的声誉点来评论已接受的答案,但是因为您使用的是Django 1.5,所以不应该要求{%load url from future%}.它仅在Django 1.3和1.4中需要. https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi