我可以使用Django-Registration redux登录和注册,除了密码更改转发到http://127.0.0.1:8000/?next=/accounts/password/change/
登陆主页外,它可以正常工作。
这些是我的应用网址:
class MyRegistrationView(RegistrationView):
def get_success_url(self,user):
return('/createprofile/')
urlpatterns=[
url(r'^$', views.index, name='index'),
url(r'^city/(?P<city_name_slug>[\w\-]+)/$', views.show_city, name='show_city'),
url(r'^user/(?P<username>[\w\-]+)/$', views.show_profile, name='show_profile'),
url(r'^search/$', views.search, name='search'),
url(r'accounts/register/$', MyRegistrationView.as_view(), name='registraion_register'),
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'^createprofile/$', views.createprofile, name="createprofile"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
这是我用来更改密码的链接:
<p>
forgot your password? Ney bother.
<a href="{% url 'excurj:auth_password_change' %}">Reset password</a>
</p>
这是与其他注册表单存储在同一位置的password_change_form.html表单:
{% extends 'base.html' %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block content %}
<form method="post" action=".">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
这是http://127.0.0.1:8000/accounts/:
的结果编辑:上述情况发生在用户未登录时。登录时出现此错误:
NoReverseMatch at / accounts / password / change / Reverse for &#39; auth_password_change_done&#39;参数&#39;()&#39;和关键字参数 &#39; {}&#39;未找到。尝试了0种模式:[]
答案 0 :(得分:0)
我发现这个问题:
url(r'^accounts/', include('registration.backends.default.urls')),
在app的url.py中,但它需要在项目的url.py中。