added logout function
This commit is contained in:
parent
8df4347932
commit
6e700359ce
0
logout/__init__.py
Normal file
0
logout/__init__.py
Normal file
3
logout/admin.py
Normal file
3
logout/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
5
logout/apps.py
Normal file
5
logout/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class LogoutConfig(AppConfig):
|
||||||
|
name = 'logout'
|
0
logout/migrations/__init__.py
Normal file
0
logout/migrations/__init__.py
Normal file
3
logout/models.py
Normal file
3
logout/models.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
3
logout/tests.py
Normal file
3
logout/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
12
logout/urls.py
Normal file
12
logout/urls.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Logout app URL configuration.
|
||||||
|
"""
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
app_name = 'logout'
|
||||||
|
urlpatterns = [
|
||||||
|
path('', views.index, name='index'),
|
||||||
|
]
|
15
logout/views.py
Normal file
15
logout/views.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
/logout app views.
|
||||||
|
"""
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.contrib.auth import logout
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
"""
|
||||||
|
Logs the user out.
|
||||||
|
"""
|
||||||
|
logout(request)
|
||||||
|
messages.success(request, "Logged out")
|
||||||
|
return redirect('homepage:index')
|
Loading…
Reference in New Issue
Block a user