您的應用程序views.py文件中,覆蓋的Django PasswordChangeView allauth
from django.core.urlresolvers import reverse_lazy
from allauth.account.views import PasswordChangeView
class LoginAfterPasswordChangeView(PasswordChangeView):
@property
def success_url(self):
return reverse_lazy('generic:password_change_success')
login_after_password_change = login_required(LoginAfterPasswordChangeView.as_view())
在urls.py
(Django在何處allauth網址居住)。上述 這個網址建議立即進行刪除自帶高於此(URL(R '^賬戶/',包括( 'allauth.urls')))覆蓋默認密碼更改行爲
url(r'^accounts/password/change/$', generic_views.login_after_password_change, name='account_change_password'),
url(r'^accounts/', include('allauth.urls')),
此功能succefully變更後重定向密碼。 在這裏你必須在帳戶模板文件夾這個名字 「password_change_success.html」 創建一個HTML頁面
@login_required
def password_change_success(request):
template = "account/password_change_success.html"
return render(request, template)
在url.py
url(r'^password_change_success/$', views.password_change_success, name="password_change_success"),