diff --git a/InvenTree/part/templatetags/plugin_extras.py b/InvenTree/part/templatetags/plugin_extras.py index c5e86a6900..51a115b67e 100644 --- a/InvenTree/part/templatetags/plugin_extras.py +++ b/InvenTree/part/templatetags/plugin_extras.py @@ -4,6 +4,7 @@ """ from django.conf import settings as djangosettings from django import template +from django.urls import reverse from common.models import InvenTreeSetting @@ -35,3 +36,12 @@ def navigation_enabled(*args, **kwargs): if djangosettings.TESTING: return True return InvenTreeSetting.get_setting('ENABLE_PLUGINS_NAVIGATION') + + +@register.simple_tag() +def safe_url(view_name, *args, **kwargs): + """ safe lookup for urls """ + try: + return reverse(view_name, args=args, kwargs=kwargs) + except: + return None diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index cd2a2a0a56..02f7b2e6b7 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -70,7 +70,10 @@