new tag for url resolve

This commit is contained in:
Matthias 2021-07-05 00:46:51 +02:00
parent eaf191dc8d
commit 369acb494b

View File

@ -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('<b><a href="{}">{}</a></b>'.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