From a780d31c15397e893cb31f15df2891489bd4a68f Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Mon, 17 Mar 2025 09:51:52 +0100 Subject: [PATCH] Add organization indicator --- src/servala/frontend/context_processors.py | 5 ++++ .../frontend/templates/includes/sidebar.html | 30 +++++++++++++++++++ src/servala/settings.py | 6 ++-- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 src/servala/frontend/context_processors.py diff --git a/src/servala/frontend/context_processors.py b/src/servala/frontend/context_processors.py new file mode 100644 index 0000000..1a180d8 --- /dev/null +++ b/src/servala/frontend/context_processors.py @@ -0,0 +1,5 @@ +def add_organizations(request): + if not request.user.is_authenticated: + return {"user_organizations": []} + + return {"user_organizations": request.user.organizations.all()} diff --git a/src/servala/frontend/templates/includes/sidebar.html b/src/servala/frontend/templates/includes/sidebar.html index 2baecb5..617ff56 100644 --- a/src/servala/frontend/templates/includes/sidebar.html +++ b/src/servala/frontend/templates/includes/sidebar.html @@ -56,6 +56,36 @@