mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-17 12:42:52 -06:00
Rename entry point group; simplify import
This commit is contained in:
parent
dab313897e
commit
28b5e88c50
@ -640,19 +640,12 @@ if PAGINATE_COUNT not in PER_PAGE_DEFAULTS:
|
|||||||
|
|
||||||
PLUGINS = []
|
PLUGINS = []
|
||||||
if PLUGINS_ENABLED:
|
if PLUGINS_ENABLED:
|
||||||
for entry_point in iter_entry_points(group='netbox.plugin', name=None):
|
for entry_point in iter_entry_points(group='netbox_plugins', name=None):
|
||||||
plugin = entry_point.module_name
|
plugin = entry_point.module_name
|
||||||
PLUGINS.append(plugin)
|
PLUGINS.append(plugin)
|
||||||
INSTALLED_APPS.append(plugin)
|
INSTALLED_APPS.append(plugin)
|
||||||
|
|
||||||
# Import the app config and locate the inner meta class
|
app_config = entry_point.load()
|
||||||
try:
|
|
||||||
module = importlib.import_module(plugin)
|
|
||||||
default_app_config = getattr(module, 'default_app_config')
|
|
||||||
module, app_config = default_app_config.rsplit('.', 1)
|
|
||||||
app_config = getattr(importlib.import_module(module), app_config)
|
|
||||||
except ImportError:
|
|
||||||
raise ImproperlyConfigured('Plugin config for {} could not be imported!'.format(plugin))
|
|
||||||
|
|
||||||
app_config_meta = getattr(app_config, 'NetBoxPluginMeta', None)
|
app_config_meta = getattr(app_config, 'NetBoxPluginMeta', None)
|
||||||
if not app_config_meta:
|
if not app_config_meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user