mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-22 08:48:41 +02:00
#19773: Include Django apps in system status view
This commit is contained in:
17
netbox/utilities/apps.py
Normal file
17
netbox/utilities/apps.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.apps import apps
|
||||
|
||||
|
||||
def get_installed_apps():
|
||||
"""
|
||||
Return the name and version number for each installed Django app.
|
||||
"""
|
||||
installed_apps = {}
|
||||
for app_config in apps.get_app_configs():
|
||||
app = app_config.module
|
||||
if version := getattr(app, 'VERSION', getattr(app, '__version__', None)):
|
||||
if type(version) is tuple:
|
||||
version = '.'.join(str(n) for n in version)
|
||||
installed_apps[app_config.name] = version
|
||||
return {
|
||||
k: v for k, v in sorted(installed_apps.items())
|
||||
}
|
||||
Reference in New Issue
Block a user