django - 无反向匹配 : in the password reset form in Django-registration?

标签 django django-forms django-registration django-users

访问此 URL 时出现以下错误 http://127.0.0.1:8000/accounts/password/reset/

Request Method: GET
Request URL:    http://127.0.0.1:8000/accounts/password/reset/
Django Version: 1.6.2
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

我的password_reset_form.html

{% extends "registration/base.html" %}
{% load i18n %}

{% block breadcrumbs %}<div class="breadcrumbs"></div>{% endblock %}

{% block title %}{% trans "Password reset" %}{% endblock %}

{% block content %}

<h1>{% trans "Password reset" %}</h1>

<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p>

<form action="" method="post">
    {% csrf_token %}
{{ form.email.errors }}
<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p>
</form>

{% endblock %}

编辑: 我已经按照frnhr的建议更正了,但是弹出以下错误。

TemplateSyntaxError at /accounts/password/reset/
Could not parse the remainder: ',' from 'uid,'
Request Method: POST
Request URL:    http://127.0.0.1:8000/accounts/password/reset/
Django Version: 1.6.2
Exception Type: TemplateSyntaxError
Exception Value:    
Could not parse the remainder: ',' from 'uid,'
Exception Location: /Users/sridhar/Documents/virtualenvs/django/django/lib/python2.7/site-packages/django/template/base.py in __init__, line 577
Python Executable:  /Users/sridhar/Documents/virtualenvs/django/django/bin/python
Python Version: 2.7.5

最佳答案

Django 注册尚未与 Djagno 1.6 兼容。此补丁将解决您的问题:https://bitbucket.org/ubernostrum/django-registration/pull-request/63/django-16-compatibility-fix-auth-views/diff

registration/auth_urls.py:

urlpatterns = patterns('',
                       url(r'^login/$',
                           auth_views.login,
                           {'template_name': 'registration/login.html'},
                           name='auth_login'),
                       url(r'^logout/$',
                           auth_views.logout,
                           {'template_name': 'registration/logout.html'},
                           name='auth_logout'),
                       url(r'^password/change/$',
                           auth_views.password_change,
                           {'post_change_redirect': reverse_lazy('auth_password_change_done')},
                           name='auth_password_change'),
                       url(r'^password/change/done/$',
                           auth_views.password_change_done,
                           name='auth_password_change_done'),
                       url(r'^password/reset/$',
                           auth_views.password_reset,
                           {'post_reset_redirect': reverse_lazy('auth_password_reset_done')},
                           name='auth_password_reset'),
                       url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
                           auth_views.password_reset_confirm,
                           name='auth_password_reset_confirm'),
                       url(r'^password/reset/complete/$',
                           auth_views.password_reset_complete,
                           {'post_reset_redirect': reverse_lazy('auth_password_reset_complete')},
                           name='auth_password_reset_complete'),
                       url(r'^password/reset/done/$',
                           auth_views.password_reset_done,
                           name='auth_password_reset_done'),
)

关于django - 无反向匹配 : in the password reset form in Django-registration?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22571413/

相关文章:

python - 从 ORM 中提取数据并按日期分组

python - 如何根据模型领域选择形式

django - 在django模板中获取用户信息

python - 带有表单的 TemplateView - 'unicode' 对象没有属性 'get'

python - django模板中的两种形式没有冲突

python - 从 django 注册表中删除第二个密码输入

django - 定制登记表。确认密码

python - Tango with Django - 第 8 章 - 练习

python - 在Django中创建对象时将当前登录的用户设置为模型中的用户

jquery - 如何在 django 中使用日期选择器