mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Backport plugin_static
template tag to 0.15.x (#7764)
This commit is contained in:
parent
0d8eb2e0b3
commit
0f3b719c80
@ -2,6 +2,7 @@
|
||||
|
||||
from django import template
|
||||
from django.conf import settings as djangosettings
|
||||
from django.templatetags.static import static
|
||||
from django.urls import reverse
|
||||
|
||||
from common.models import InvenTreeSetting
|
||||
@ -96,3 +97,17 @@ def notification_list(context, *args, **kwargs):
|
||||
}
|
||||
for a in storage.liste
|
||||
]
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def plugin_static(file: str, **kwargs):
|
||||
"""Return the URL for a static file within a plugin.
|
||||
|
||||
Arguments:
|
||||
file: The path to the file within the plugin static directory
|
||||
|
||||
Keyword Arguments:
|
||||
plugin: The plugin slug (optional, will be inferred from the context if not provided)
|
||||
|
||||
"""
|
||||
return static(file)
|
||||
|
Loading…
Reference in New Issue
Block a user