mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
new tag for url resolve
This commit is contained in:
parent
eaf191dc8d
commit
369acb494b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user