diff --git a/appunti/settings.py b/appunti/settings.py index cb01340..2fc2175 100644 --- a/appunti/settings.py +++ b/appunti/settings.py @@ -136,3 +136,4 @@ REST_FRAMEWORK = { LOGIN_URL = "login" LOGIN_REDIRECT_URL = "/" +LOGOUT_REDIRECT_URL = "login" diff --git a/notes/static/notes/images/icons/logout.png b/notes/static/notes/images/icons/logout.png new file mode 100644 index 0000000..35723a6 Binary files /dev/null and b/notes/static/notes/images/icons/logout.png differ diff --git a/notes/static/notes/stylesheets/style.css b/notes/static/notes/stylesheets/style.css index cd2a9f7..f98e0a3 100644 --- a/notes/static/notes/stylesheets/style.css +++ b/notes/static/notes/stylesheets/style.css @@ -28,6 +28,12 @@ header img { margin: 20px; } +.logout { + padding: 0; + background: transparent; + border: none; +} + main { padding: 0 30px; } diff --git a/notes/templates/notes/base.html b/notes/templates/notes/base.html index c657d83..fcc632e 100644 --- a/notes/templates/notes/base.html +++ b/notes/templates/notes/base.html @@ -16,6 +16,10 @@ Profile +
+ {% csrf_token %} + +
{% block body %} diff --git a/notes/urls.py b/notes/urls.py index b0995cb..315b11c 100644 --- a/notes/urls.py +++ b/notes/urls.py @@ -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 notes import views, api_views @@ -9,6 +9,7 @@ urlpatterns = [ path("post-a-note/", views.PostNoteView.as_view(), name="post-a-note"), path("profile/", views.ProfileView.as_view(), name="profile"), 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-auth/", include("rest_framework.urls", namespace="rest_framework")), ]