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
View File
@@ -5,6 +5,7 @@
### Fixed
* Make the required single platform destination explicit when creating an installation
* Fix installation form submission on NetBox v4.6.5 when form mixins return no cleaned-data value
### Added
+1 -1
View File
@@ -63,7 +63,7 @@ Die installierte Version kann anschließend geprüft werden:
/opt/netbox/venv/bin/pip show netbox-slm
```
Für diese Variante muss dort mindestens Version `1.11.1` stehen.
Für diese Variante muss dort mindestens Version `1.11.2` stehen.
### 3. Plugin in NetBox aktivieren
+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):