fix: register IP range list buttons on NetBox 4.6+

NetBox resolves template_content relative to the PluginConfig's module, so the extension was never loaded while the config lived in config.py. NetBox 4.7 also only reads the models list, not the singular model attribute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-26 21:24:20 +01:00
1 parent 4eaf037ae6
commit 34be43bffb
3 files changed
+31 -28

No files matched your search

+30 -1
View File
@@ -1,4 +1,33 @@
from .config import BetterIPsConfig
from netbox.plugins import PluginConfig
__version__ = "1.2.2"
# Defined here rather than in a submodule: NetBox resolves default resources
# such as template_content relative to the PluginConfig's module.
class BetterIPsConfig(PluginConfig):
name = "netbox_better_ips"
verbose_name = "NetBox Better IPs"
description = "Automatic IP ranges from IP addresses and an extended IP network overview"
author = "LKE"
version = __version__
base_url = "better-ips"
min_version = "4.6.5"
max_version = "4.7.99"
default_settings = {
"auto_create_range": True,
"range_status": "active",
"inherit_tenant": True,
"ignore_host_prefixes": True,
}
def ready(self):
super().ready()
from . import signals # noqa: F401
from . import tables # noqa: F401
from .navigation import register_ipam_menu_item
register_ipam_menu_item()
config = BetterIPsConfig
-26
View File
@@ -1,26 +0,0 @@
from netbox.plugins import PluginConfig
class BetterIPsConfig(PluginConfig):
name = "netbox_better_ips"
verbose_name = "NetBox Better IPs"
description = "Automatische Prefix-Zuordnung und erweiterte IP-Netzübersicht"
author = "LKE"
version = "1.2.2"
base_url = "better-ips"
min_version = "4.6.5"
max_version = "4.7.99"
default_settings = {
"auto_create_range": True,
"range_status": "active",
"inherit_tenant": True,
"ignore_host_prefixes": True,
}
def ready(self):
super().ready()
from . import signals # noqa: F401
from . import tables # noqa: F401
from .navigation import register_ipam_menu_item
register_ipam_menu_item()
+1 -1
View File
@@ -2,7 +2,7 @@ from netbox.plugins import PluginTemplateExtension
class IPRangeListActions(PluginTemplateExtension):
model = "ipam.iprange"
models = ["ipam.iprange"]
def list_buttons(self):
return self.render("netbox_better_ips/inc/iprange_list_buttons.html")