fix: handle NetBox form clean return value

Read installation destinations from self.cleaned_data because NetBox 4.6.5 form mixins return None while cleaning newly created objects.
This commit is contained in:
2026-07-27 12:31:26 +02:00
parent 71a5db0ece
commit 9f3bddfbb1
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ limitations under the License.
from netbox.plugins import PluginConfig
from django.utils.translation import gettext_lazy as _
__version__ = "1.11.1"
__version__ = "1.11.2"
class SLMConfig(PluginConfig):
@@ -75,15 +75,15 @@ class SoftwareProductInstallationForm(NetBoxModelForm):
return version
def clean(self):
cleaned_data = super().clean()
super().clean()
destinations = [
cleaned_data.get("device"),
cleaned_data.get("virtualmachine"),
cleaned_data.get("cluster"),
self.cleaned_data.get("device"),
self.cleaned_data.get("virtualmachine"),
self.cleaned_data.get("cluster"),
]
if sum(destination is not None for destination in destinations) != 1:
raise ValidationError(_("Select exactly one platform destination: device, virtual machine, or cluster."))
return cleaned_data
return self.cleaned_data
class SoftwareProductInstallationFilterForm(NetBoxModelFilterSetForm):