From 420a7b147205fe8b46cdf1eea43c7d20c0358c9c Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 27 Mar 2023 15:56:15 -0500 Subject: [PATCH] add the ability to disable the web display of some apps --- dr_botzo/context_processors.py | 3 +- dr_botzo/settings.py | 10 ++++++ dr_botzo/templates/base.html | 4 +-- karma/views.py | 13 +++++--- races/views.py | 12 ++++--- tests/test_races_views.py | 3 -- tests/test_web_enabled_app_settings.py | 46 ++++++++++++++++++++++++++ 7 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 tests/test_web_enabled_app_settings.py diff --git a/dr_botzo/context_processors.py b/dr_botzo/context_processors.py index 6359a89..c0f8a0b 100644 --- a/dr_botzo/context_processors.py +++ b/dr_botzo/context_processors.py @@ -1,5 +1,5 @@ """Site processors to add additional template tags and whatnot.""" - +from django.conf import settings from django.contrib.sites.shortcuts import get_current_site from django.utils.functional import SimpleLazyObject @@ -11,4 +11,5 @@ def site(request): return { 'site': site, 'site_root': SimpleLazyObject(lambda: "{0}://{1}".format(protocol, site.domain)), + 'WEB_ENABLED_APPS': settings.WEB_ENABLED_APPS, } diff --git a/dr_botzo/settings.py b/dr_botzo/settings.py index b55a915..083d9e4 100644 --- a/dr_botzo/settings.py +++ b/dr_botzo/settings.py @@ -145,6 +145,16 @@ BOOTSTRAP3 = { 'javascript_in_head': True, } +############### +# web options # +############### + +# choose which apps to display in the web UI, for those that support this config +WEB_ENABLED_APPS = [ + 'karma', + 'races', +] + # IRC module stuff diff --git a/dr_botzo/templates/base.html b/dr_botzo/templates/base.html index 788bd37..e8eb4b0 100644 --- a/dr_botzo/templates/base.html +++ b/dr_botzo/templates/base.html @@ -30,9 +30,9 @@ {% block navbar_menu %} {% endblock %}