From 369acb494b18abb1ba0384667e3a5e6e91da97c7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 5 Jul 2021 00:46:51 +0200 Subject: [PATCH] new tag for url resolve --- InvenTree/part/templatetags/inventree_extras.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 38689df26b..4cc219454b 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -11,7 +11,7 @@ from django.utils.translation import ugettext_lazy as _ from django.conf import settings as djangosettings from django import template -from django.urls import reverse +from django.urls import reverse, resolve as resolve_fnc from django.utils.safestring import mark_safe from django.templatetags.static import StaticNode from InvenTree import version, settings @@ -267,6 +267,12 @@ def object_link(url_name, pk, ref): return mark_safe('{}'.format(ref_url, ref)) +@register.simple_tag() +def resolve(url): + """provides access to resolve function in templates""" + return resolve_fnc(url) + + class I18nStaticNode(StaticNode): """ custom StaticNode