mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
[FR] Add plugin keys, state and version to version info (#3496)
* [FR] Add plugin keys, state and version to version info Fixes #3477 * Add info to general API endpoint
This commit is contained in:
@ -17,6 +17,7 @@ import InvenTree.helpers
|
||||
from common.models import ColorTheme, InvenTreeSetting, InvenTreeUserSetting
|
||||
from common.settings import currency_code_default
|
||||
from InvenTree import settings, version
|
||||
from plugin import registry
|
||||
from plugin.models import NotificationUserSetting, PluginSetting
|
||||
|
||||
register = template.Library()
|
||||
@ -149,6 +150,25 @@ def plugins_enabled(*args, **kwargs):
|
||||
return djangosettings.PLUGINS_ENABLED
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def plugins_info(*args, **kwargs):
|
||||
"""Return information about activated plugins."""
|
||||
# Check if plugins are even enabled
|
||||
if not djangosettings.PLUGINS_ENABLED:
|
||||
return False
|
||||
|
||||
# Fetch plugins
|
||||
plug_list = [plg for plg in registry.plugins.values() if plg.plugin_config().active]
|
||||
# Format list
|
||||
return [
|
||||
{
|
||||
'name': plg.name,
|
||||
'slug': plg.slug,
|
||||
'version': plg.version
|
||||
} for plg in plug_list
|
||||
]
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_db_engine(*args, **kwargs):
|
||||
"""Return the InvenTree database backend e.g. 'postgresql'."""
|
||||
|
Reference in New Issue
Block a user