How to access custom template using auth_views?

345 views
Skip to first unread message

Yasir Iqbal

unread,
Jul 5, 2020, 7:58:25 PM7/5/20
to Django users
I am having difficulty to access my custom template when I tried to logout or password_change and I redirect to django built-in template. Only login is working fine with my login custom template.Can anyone help me please.Thanks
Here is my code urls.py 


from django.urls import path
from django.contrib.auth import views as auth_views

from . import views

urlpatterns=[

    #path('login/',views.user_login,name='login'),
    path('',views.dashboard, name='dashboard'),
    path('login/',auth_views.LoginView.as_view(),name='login'),
    path('logout/',auth_views.LogoutView.as_view(template_name='registration/logged_out.html',next_page=None),name='logout'),
    #change password url
    path('password_change/',auth_views.PasswordChangeView.as_view(template_name='registration/password_change_form.html'), name='password_change'),

    
]

Exactly musty

unread,
Jul 5, 2020, 8:05:05 PM7/5/20
to django...@googlegroups.com
i recommend you use django-allauth,for its easier, you won't have to struggle for authentication as django has taken care of everything for you

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/37ebe875-d24f-455a-b9de-9e7ae76423c4o%40googlegroups.com.

Yasir Iqbal

unread,
Jul 5, 2020, 8:33:02 PM7/5/20
to Django users
Thanks for you response but in current scenario I have to use from django.contrib.auth import views as auth_views. Please help me out. Thanks

On Monday, 6 July 2020 01:05:05 UTC+5, Exactly musty wrote:
i recommend you use django-allauth,for its easier, you won't have to struggle for authentication as django has taken care of everything for you

On Sun, Jul 5, 2020 at 8:58 PM Yasir Iqbal <yasiriq...@gmail.com> wrote:
I am having difficulty to access my custom template when I tried to logout or password_change and I redirect to django built-in template. Only login is working fine with my login custom template.Can anyone help me please.Thanks
Here is my code urls.py 


from django.urls import path
from django.contrib.auth import views as auth_views

from . import views

urlpatterns=[

    #path('login/',views.user_login,name='login'),
    path('',views.dashboard, name='dashboard'),
    path('login/',auth_views.LoginView.as_view(),name='login'),
    path('logout/',auth_views.LogoutView.as_view(template_name='registration/logged_out.html',next_page=None),name='logout'),
    #change password url
    path('password_change/',auth_views.PasswordChangeView.as_view(template_name='registration/password_change_form.html'), name='password_change'),

    
]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Exactly musty

unread,
Jul 5, 2020, 9:17:23 PM7/5/20
to Django users
try this then clear cache on your browser path('logout/', auth_views.LogoutView.as_view(template_name='registration/logged_out.html'), name='logout'),
Reply all
Reply to author
Forward
0 new messages