mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add custom report template tags
This commit is contained in:
parent
801b945438
commit
6230fb3614
22
InvenTree/part/templatetags/report.py
Normal file
22
InvenTree/part/templatetags/report.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""
|
||||
Custom template tags for report generation
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def asset(filename):
|
||||
"""
|
||||
Return fully-qualified path for an upload report asset file.
|
||||
"""
|
||||
|
||||
path = os.path.join(settings.MEDIA_ROOT, 'report', 'assets', filename)
|
||||
path = os.path.abspath(path)
|
||||
|
||||
return f"file://{path}"
|
Loading…
Reference in New Issue
Block a user