2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00
2022-01-11 01:00:41 +01:00

20 lines
523 B
Python

"""
load templates for loaded plugins
"""
from django.template.loaders.filesystem import Loader as FilesystemLoader
from pathlib import Path
from plugin import registry
class PluginTemplateLoader(FilesystemLoader):
def get_dirs(self):
dirname = 'templates'
template_dirs = []
for plugin in registry.plugins.values():
new_path = Path(plugin.path) / dirname
if Path(new_path).is_dir():
template_dirs.append(new_path)
return tuple(template_dirs)