Answers for "AttributeError: module 'django.contrib.auth.views' has no attribute 'login'"

2

AttributeError: module 'django.contrib.auth.views' has no attribute 'login'

from django.contrib.auth import views as auth_views

urlpatterns = [
   url( r'^login/$',auth_views.LoginView.as_view(template_name="useraccounts/login.html"), name="login"),
]
Posted by: Guest on May-21-2020
0

'django.contrib.auth.views' has no attribute 'logout'

Open urls.py and replace:

django.contrib.auth.views.login with django.contrib.auth.views.LoginView

django.contrib.auth.views.logout with django.contrib.auth.views.LogoutView
Posted by: Guest on September-16-2021

Code answers related to "AttributeError: module 'django.contrib.auth.views' has no attribute 'login'"

Python Answers by Framework

Browse Popular Code Answers by Language