Add logout
This commit is contained in:
@@ -136,3 +136,4 @@ REST_FRAMEWORK = {
|
|||||||
|
|
||||||
LOGIN_URL = "login"
|
LOGIN_URL = "login"
|
||||||
LOGIN_REDIRECT_URL = "/"
|
LOGIN_REDIRECT_URL = "/"
|
||||||
|
LOGOUT_REDIRECT_URL = "login"
|
||||||
|
|||||||
BIN
notes/static/notes/images/icons/logout.png
Normal file
BIN
notes/static/notes/images/icons/logout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -28,6 +28,12 @@ header img {
|
|||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
padding: 0 30px;
|
padding: 0 30px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
<a href="{% url "profile" %}">
|
<a href="{% url "profile" %}">
|
||||||
<img src="{% static "notes/images/icons/profile.png" %}" alt="Profile" title="Profile" />
|
<img src="{% static "notes/images/icons/profile.png" %}" alt="Profile" title="Profile" />
|
||||||
</a>
|
</a>
|
||||||
|
<form method="post" action="{% url "logout" %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="logout"><img src="{% static "notes/images/icons/logout.png" %}" alt="Logout" title="Logout" /></button>
|
||||||
|
</form>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from django.contrib.auth.views import LoginView
|
from django.contrib.auth.views import LoginView, LogoutView
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
|
|
||||||
from notes import views, api_views
|
from notes import views, api_views
|
||||||
@@ -9,6 +9,7 @@ urlpatterns = [
|
|||||||
path("post-a-note/", views.PostNoteView.as_view(), name="post-a-note"),
|
path("post-a-note/", views.PostNoteView.as_view(), name="post-a-note"),
|
||||||
path("profile/", views.ProfileView.as_view(), name="profile"),
|
path("profile/", views.ProfileView.as_view(), name="profile"),
|
||||||
path("login/", LoginView.as_view(), name='login'),
|
path("login/", LoginView.as_view(), name='login'),
|
||||||
|
path("logout/", LogoutView.as_view(), name='logout'),
|
||||||
path("api/notes/", api_views.NoteListView.as_view(), name="api-notes-list"),
|
path("api/notes/", api_views.NoteListView.as_view(), name="api-notes-list"),
|
||||||
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user