Fix ModuleNotFoundError on plugin load: use relative resource paths
PluginConfig._load_resource() prepends self.__module__ (already
'netbox_rack_concept') to the configured path, so 'menu' and
'template_extensions' must be given relative to the plugin package
('navigation.menu', 'template_content.template_extensions'), not
prefixed with 'netbox_rack_concept.' again. The prefixed form made
Django try to import 'netbox_rack_concept.netbox_rack_concept...',
which doesn't exist, crashing manage.py on every command.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,10 @@ class RackConceptConfig(PluginConfig):
|
|||||||
base_url = 'rack-concepts'
|
base_url = 'rack-concepts'
|
||||||
min_version = '4.6.0'
|
min_version = '4.6.0'
|
||||||
max_version = '4.6.99'
|
max_version = '4.6.99'
|
||||||
menu = 'netbox_rack_concept.navigation.menu'
|
# These paths are relative to this module (NetBox prepends self.__module__),
|
||||||
template_extensions = 'netbox_rack_concept.template_content.template_extensions'
|
# so they must NOT be prefixed with 'netbox_rack_concept.' again.
|
||||||
|
menu = 'navigation.menu'
|
||||||
|
template_extensions = 'template_content.template_extensions'
|
||||||
|
|
||||||
default_settings = {
|
default_settings = {
|
||||||
# Defaults used when a concept is created from scratch.
|
# Defaults used when a concept is created from scratch.
|
||||||
|
|||||||
Reference in New Issue
Block a user