diff --git a/README.md b/README.md index 3ff1f29..cee2ff1 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,11 @@ For now all configuration is done in the NetBox admin back-end. A later version ## Compatibility -This plugin in compatible with [NetBox](https://netbox.readthedocs.org/) 2.8 and later. NetBox 2.10 introduced breaking -changes that make it unusable for my own use cases, so I will not be providing support for it. There is work being done -to create a fork of NetBox that is friendlier to both network operators and contributors. My future work will be in -support of that. +This plugin in compatible with [NetBox](https://netbox.readthedocs.org/) 2.8, 2.9 and 2.10. + +NetBox 2.10 introduced breaking changes that make it unusable for my own use cases. There is work being done to create +a fork of NetBox that is friendlier to both network operators and contributors. My future work will be in support of +that. ## Installation diff --git a/netbox_ddns/__init__.py b/netbox_ddns/__init__.py index 42af7fd..fadb448 100644 --- a/netbox_ddns/__init__.py +++ b/netbox_ddns/__init__.py @@ -1,4 +1,4 @@ -VERSION = '1.0.8' +VERSION = '1.1.0' try: from extras.plugins import PluginConfig @@ -12,6 +12,8 @@ class NetBoxDDNSConfig(PluginConfig): name = 'netbox_ddns' verbose_name = 'Dynamic DNS' version = VERSION + min_version = '2.8' + max_version = '2.10' author = 'Sander Steffann' author_email = 'sander@steffann.nl' description = 'Dynamic DNS Connector for NetBox' diff --git a/netbox_ddns/views.py b/netbox_ddns/views.py index eb3df94..e46b9a6 100644 --- a/netbox_ddns/views.py +++ b/netbox_ddns/views.py @@ -12,9 +12,16 @@ from netbox_ddns.background_tasks import dns_create from netbox_ddns.forms import ExtraDNSNameEditForm from netbox_ddns.models import DNSStatus, ExtraDNSName from netbox_ddns.utils import normalize_fqdn -from utilities.views import ObjectDeleteView, ObjectEditView + +try: + # NetBox <= 2.9 + from utilities.views import ObjectDeleteView, ObjectEditView +except ImportError: + # NetBox >= 2.10 + from netbox.views.generic import ObjectDeleteView, ObjectEditView +# noinspection PyMethodMayBeStatic class ExtraDNSNameObjectMixin: def get_object(self, kwargs): if 'ipaddress_pk' not in kwargs: @@ -60,6 +67,7 @@ class ExtraDNSNameDeleteView(PermissionRequiredMixin, ExtraDNSNameObjectMixin, O class IPAddressDNSNameRecreateView(PermissionRequiredMixin, View): permission_required = 'ipam.change_ipaddress' + # noinspection PyMethodMayBeStatic def post(self, request, ipaddress_pk): ip_address = get_object_or_404(IPAddress, pk=ipaddress_pk)