-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
djang2.0内置登录方法等,已经不用login,loginout #6
Comments
liuchangfu
changed the title
djang2.0内置登录方法等,已经不用login(),loginout
djang2.0内置登录方法等,已经不用login,loginout
Nov 23, 2018
非常感谢。重印时修改。
Change <[email protected]> 于2018年11月23日周五 下午10:36写道:
… path('login/', auth_views.login, name='user_login'),
path('new-login/', auth_views.login, {'template_name':
'account/login.html'}, name='user_login'),
path('logout/', auth_views.logout, {'template_name':
'account/logout.html'}, name='user_logout'),
path('register/', views.register, name='user_register'),
path('password-change/', auth_views.password_change,
{"post_change_redirect":"/account/password-change-done", 'template_name':
'account/password_change_form.html'}, name='password_change'),
path('password-change-done/', auth_views.password_change_done,
{'template_name': 'account/password_change_done.html'},
name='password_change_done'),
path('password-reset/', auth_views.password_reset,
{"template_name":"account/password_reset_form.html",
"email_template_name":"account/password_reset_email.html",
"subject_template_name":"account/password_reset_subject.txt",
"post_reset_redirect":"/account/password-reset-done"},
name="password_reset"),
path('password-reset-done/', auth_views.password_reset_done,
{"template_name":"account/password_reset_done.html"},
name="password_reset_done"),
path('password-reset-confirm///', auth_views.password_reset_confirm,
{"template_name":"account/password_reset_confirm.html",
"post_reset_redirect":"/account/password-reset-complete"},
name="password_reset_confirm"),
path('password-reset-complete/', auth_views.password_reset_complete,
{"template_name":"account/password_reset_complete.html"},
name="password_reset_complete"),
上述代码中的内置方法,已经在django2.0不适用了,代码需修改,从以下模块中导入内置方法
from django.contrib.auth.views import LoginView
url中需修改为以下代码
path('login/', LoginView.as_view(), name='user_login'), # django内置登录
path('new-login/', LoginView.as_view(), {'template_name':
'account/login.html'}, name='user_login'),
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ADel6yjLevpoJYGQOt0nVYWIOPWkFlmMks5uyAfXgaJpZM4YwwQu>
.
--
*QiWei*
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
path('login/', auth_views.login, name='user_login'),
path('new-login/', auth_views.login, {'template_name': 'account/login.html'}, name='user_login'),
path('logout/', auth_views.logout, {'template_name': 'account/logout.html'}, name='user_logout'),
path('register/', views.register, name='user_register'),
path('password-change/', auth_views.password_change, {"post_change_redirect":"/account/password-change-done", 'template_name': 'account/password_change_form.html'}, name='password_change'),
path('password-change-done/', auth_views.password_change_done, {'template_name': 'account/password_change_done.html'}, name='password_change_done'),
path('password-reset/', auth_views.password_reset, {"template_name":"account/password_reset_form.html", "email_template_name":"account/password_reset_email.html", "subject_template_name":"account/password_reset_subject.txt", "post_reset_redirect":"/account/password-reset-done"}, name="password_reset"),
path('password-reset-done/', auth_views.password_reset_done, {"template_name":"account/password_reset_done.html"}, name="password_reset_done"),
path('password-reset-confirm///', auth_views.password_reset_confirm, {"template_name":"account/password_reset_confirm.html", "post_reset_redirect":"/account/password-reset-complete"}, name="password_reset_confirm"),
path('password-reset-complete/', auth_views.password_reset_complete, {"template_name":"account/password_reset_complete.html"}, name="password_reset_complete"),
上述代码中的内置方法,已经在django2.0不适用了,代码需修改,从以下模块中导入内置方法
from django.contrib.auth.views import LoginView
url中需修改为以下代码
path('login/', LoginView.as_view(), name='user_login'), # django内置登录
path('new-login/', LoginView.as_view(), {'template_name': 'account/login.html'}, name='user_login'),
The text was updated successfully, but these errors were encountered: