InvenTree/InvenTree/plugin/loader.py
Oliver dc9e25ebad Adds API endpoints for viewing and updating plugin settings
A lot of code updates / refactoring here to get this to work as expected
2022-01-04 20:27:35 +11:00

20 lines
537 B
Python

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