[PR #19301] [MERGED] Fixes: #19229 Validade interface mode changes #15603

Closed
opened 2025-12-30 00:22:57 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19301
Author: @renatoalmeidaoliveira
Created: 4/24/2025
Status: Merged
Merged: 4/28/2025
Merged by: @bctiemann

Base: mainHead: 19229-cant-unset-a-device-interface-vlan-mode-without-an-error


📝 Commits (1)

  • 125bce8 Validade interface mode changes

📊 Changes

1 file changed (+6 additions, -1 deletions)

View changed files

📝 netbox/dcim/forms/common.py (+6 -1)

📄 Description

Fixes: #19229 cant unset a device interface vlan mode without an error

  • When the user changes the Interface mode, the untagged_vlan and tagged_vlans fields are unset and excluded from the InterfaceForm data.
  • Since the form instance is derived from a copy of the concrete object, the untagged_vlan and tagged_vlans remain untouched even when the mode field is modified, leading to a validation error when updating the model.
  • The fix ensures that when the form instance's mode field differs from cleaned_data["mode"], these fields are properly removed from the instance when unset, preventing validation errors.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19301 **Author:** [@renatoalmeidaoliveira](https://github.com/renatoalmeidaoliveira) **Created:** 4/24/2025 **Status:** ✅ Merged **Merged:** 4/28/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `19229-cant-unset-a-device-interface-vlan-mode-without-an-error` --- ### 📝 Commits (1) - [`125bce8`](https://github.com/netbox-community/netbox/commit/125bce84e467ec8a5342031899803e4b22562f10) Validade interface mode changes ### 📊 Changes **1 file changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms/common.py` (+6 -1) </details> ### 📄 Description ### Fixes: #19229 cant unset a device interface vlan mode without an error - When the user changes the `Interface` mode, the `untagged_vlan` and `tagged_vlans` fields are unset and excluded from the `InterfaceForm` data. - Since the form instance is derived from a copy of the concrete object, the `untagged_vlan` and `tagged_vlans` remain untouched even when the `mode` field is modified, leading to a validation error when updating the model. - The fix ensures that when the form instance's `mode` field differs from `cleaned_data["mode"]`, these fields are properly removed from the instance when unset, preventing validation errors. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:22:57 +01:00
adam closed this issue 2025-12-30 00:22:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15603