I have provided a simple login functionality. For logout, I tried to use the built-in one. This is my urls.py:
(r\'\', include(\'django.contrib.auth.urls\'))
Tested on Django 1.6:
What I do is adding this into my urls.py:
(r'^management/logout/$', 'django.contrib.auth.views.logout'),
And then used it:
Log out
For the next argument, there you point to the right URL.
Tested on Django 2.1
Append to urlpatterns in urls.py:
from django.contrib.auth import views as auth_views
urlpatterns = [
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
]
And then use it in the template:
logout
More info can be found here.