Django-nonrel + Django-registration 问题:重置密码时出现意外的关键字参数 'uidb36' [英] Django-nonrel + Django-registration problem: unexpected keyword argument 'uidb36' when resetting password

查看:29
本文介绍了Django-nonrel + Django-registration 问题:重置密码时出现意外的关键字参数 'uidb36'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Django-nonrel注册 应用程序.一切似乎都很好,除非我尝试重置密码.单击电子邮件中发送给我的重置密码链接时,Django 生成错误消息:

I'm using Django-nonrel with registration app. Things seem to be working fine, except when I try to reset my password. When clicking on reset-password link sent to me in email, Django produces error message:

password_reset_confirm() got an unexpected keyword argument 'uidb36'

我的问题:有没有人看过它并知道治疗方法是什么?

My question: has anybody seen it and knows what's the cure?

问题是由 registrationauth_urls.py 引起的——它们在 djangocontribauthurls.py 中重复了条目,绕过了 Django-nonrel 中文件的修补版本.

The problem is caused by registrationauth_urls.py - they duplicate entries in djangocontribauthurls.py, circumwenting patched version of the file in Django-nonrel.

有什么想法为什么它会在那里,我可以实际删除它或以其他方式修复它吗?

Any ideas why is it there and can I actually remove it or fix it otherwise?

推荐答案

我的解决方案是将registrationauth_urls.py中定义的urlpatterns注释掉,重新定义为django.contrib.auth中定义的urlpatterns的副本.

My solution was to comment out urlpatterns defined in registrationauth_urls.py, and redefine them as a copy of urlpatterns defined in django.contrib.auth.

这是更改后我的 auth_urls.py:

Here's my auth_urls.py after the change:

"""
URL patterns for the views included in ``django.contrib.auth``.

Including these URLs (via the ``include()`` directive) will set up the
following patterns based at whatever URL prefix they are included
under:

* User login at ``login/``.

* User logout at ``logout/``.

* The two-step password change at ``password/change/`` and
  ``password/change/done/``.

* The four-step password reset at ``password/reset/``,
  ``password/reset/confirm/``, ``password/reset/complete/`` and
  ``password/reset/done/``.

The default registration backend already has an ``include()`` for
these URLs, so under the default setup it is not necessary to manually
include these views. Other backends may or may not include them;
consult a specific backend's documentation for details.

"""

from django.conf.urls.defaults import *

#from django.contrib.auth import views as auth_views

from django.contrib.auth import urls as auth_urls

urlpatterns = auth_urls.urlpatterns

'''
Commented out, this is what caused my problems:

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,
                           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,
                           name='auth_password_reset'),
                       url(r'^password/reset/confirm/(?P<uidb36>[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,
                           name='auth_password_reset_complete'),
                       url(r'^password/reset/done/$',
                           auth_views.password_reset_done,
                           name='auth_password_reset_done'),
) 
'''

这篇关于Django-nonrel + Django-registration 问题:重置密码时出现意外的关键字参数 'uidb36'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆