From 180b017bbe4b99672698b3caff5d823f882b9414 Mon Sep 17 00:00:00 2001 From: Anders Jensen-Urstad Date: Wed, 31 Aug 2022 13:49:00 +0200 Subject: [PATCH] Fix logout; createsuperuser -> createmongodbsuperuser --- README.md | 2 +- bibstat/settings.py | 4 +++- bibstat/urls.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4c74bf3..22f59f2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Nedan är ett exempel på en minimal installation i Linux. cp bibstat/settings_local.py.example bibstat/settings_local.py vi bibstat/settings_local.py # eller nano, eller... # Skapa admin-användare - python manage.py createsuperuser --username=super --email=a@b.com + python manage.py createmongodbsuperuser --username=super --email=a@b.com # Starta servern python manage.py runserver diff --git a/bibstat/settings.py b/bibstat/settings.py index 1629038..5cd5c95 100644 --- a/bibstat/settings.py +++ b/bibstat/settings.py @@ -73,11 +73,12 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "django.contrib.admin", "django_js_reverse", # Bibstat specific apps "django_mongoengine", "django_mongoengine.mongo_auth", - #'django_mongoengine.mongo_admin', + 'django_mongoengine.mongo_admin', "libstat", ] @@ -145,6 +146,7 @@ ) LOGIN_REDIRECT_URL = "/surveys" +LOGOUT_REDIRECT_URL = "/admin" """ Logging diff --git a/bibstat/urls.py b/bibstat/urls.py index 23e9e06..3a53eb4 100644 --- a/bibstat/urls.py +++ b/bibstat/urls.py @@ -1,6 +1,6 @@ from django.urls import re_path from django.views.generic import TemplateView -from django.contrib.auth import logout +from django.contrib.auth.views import LogoutView from django_js_reverse.views import urls_js @@ -63,7 +63,7 @@ re_path(r"^export$", export_api, name="export_api"), # Auth re_path(r"^login$", login, name="login"), - re_path(r"^logout$", logout, {"next_page": "admin"}, name="logout"), + re_path(r"^logout$", LogoutView.as_view(), name='logout'), # Index re_path(r"^$", index, name="index"), re_path(r"^admin$", libstat.views.index.admin, name="admin"),