我使用的是带有自定义模板的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,'
4条答案
按热度按时间e0uiprwp1#
把这个放在上面:
删除
,
,将其放在uidb36=uid,
旁边n6lpvg4x2#
我没有足够的信誉点数来评论已接受的答案,但{% load url from future %}不应该是必需的,因为您使用的是Django 1.5。它只在Django 1.3和1.4中需要。https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi
2cmtqfgy3#
截至2022年(django4.0.5版),这里的答案对我来说都不管用,我不得不改了一行:
致:
其中
password_reset_confirm
是我在url模式中为 * 密码重置确认 * 视图指定的name
,它位于我管理用户注册系统的应用程序(该应用程序称为users
)中的urls.py
文件中:1szpjjfi4#
我的问题通过写这个得到了解决我使用的是django 4. 1
{% url“密码重置确认”uidb 64 =uid标记=标记%}