From 487ac594bb9cbe44228eac1408fa8437177f5c07 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 17 Oct 2021 19:50:06 +0200 Subject: [PATCH] testing save navigation checks --- InvenTree/part/templatetags/plugin_extras.py | 9 +++++++++ InvenTree/templates/navbar.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templatetags/plugin_extras.py b/InvenTree/part/templatetags/plugin_extras.py index e0592f8f28..590b89d7ae 100644 --- a/InvenTree/part/templatetags/plugin_extras.py +++ b/InvenTree/part/templatetags/plugin_extras.py @@ -5,6 +5,8 @@ from django.conf import settings as djangosettings from django import template +from common.models import InvenTreeSetting + register = template.Library() @@ -25,3 +27,10 @@ def plugin_settings(plugin, *args, **kwargs): def mixin_enabled(plugin, key, *args, **kwargs): """ Return if the mixin is existant and configured in the plugin """ return plugin.mixin_enabled(key) + +@register.simple_tag() +def navigation_enabled(*args, **kwargs): + """Return if plugin navigation is enabled""" + if djangosettings.TESTING: + return True + return InvenTreeSetting.get_setting('ENABLE_PLUGINS_NAVIGATION') diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index c2f6038041..ad49ecf401 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -4,7 +4,7 @@ {% load i18n %} {% settings_value 'BARCODE_ENABLE' as barcodes %} -{% settings_value 'ENABLE_PLUGINS_NAVIGATION' as plugin_nav %} +{% navigation_enabled as plugin_nav %}