[PR #20273] [MERGED] Fixes #19851: Fix WirelessLANImportForm has no field scope, improve validation #15868

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20273
Author: @jnovinger
Created: 9/5/2025
Status: Merged
Merged: 9/5/2025
Merged by: @arthanson

Base: mainHead: 19851-adjust-scope-scope_id-validation


📝 Commits (3)

  • c785b04 Make CachedScopeMixin.clean() raise non-field ValidationError
  • 126e45c Enforce field-level ValidationError in ScopedImportForm/ScopedForm.clean()
  • 4ee3044 Fix wrong field used in ValidationError

📊 Changes

2 files changed (+26 additions, -7 deletions)

View changed files

📝 netbox/dcim/forms/mixins.py (+23 -2)
📝 netbox/dcim/models/mixins.py (+3 -5)

📄 Description

Fixes: #19851

  • Changes CachedScopeMixin.clean() to raise non-field specific ValidationError
  • Adds field-specific ValidationError to ScopedForm.clean() and ScopedImportForm.clean()

I contemplated creating a re-usable ScopeRequiredError exception that sub-classes ValidataionError and handles the messaging, to avoid code duplication. Happy to change that if the reviewer disagrees with the decision not to.


🔄 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/20273 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 9/5/2025 **Status:** ✅ Merged **Merged:** 9/5/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `19851-adjust-scope-scope_id-validation` --- ### 📝 Commits (3) - [`c785b04`](https://github.com/netbox-community/netbox/commit/c785b0409bb0fbe47d96fee22386f6024b8cddfb) Make CachedScopeMixin.clean() raise non-field ValidationError - [`126e45c`](https://github.com/netbox-community/netbox/commit/126e45c1f2eea5b37bd17465580f6694977bc16e) Enforce field-level ValidationError in ScopedImportForm/ScopedForm.clean() - [`4ee3044`](https://github.com/netbox-community/netbox/commit/4ee304468e66346efa1725aec33a7e5927a19076) Fix wrong field used in ValidationError ### 📊 Changes **2 files changed** (+26 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms/mixins.py` (+23 -2) 📝 `netbox/dcim/models/mixins.py` (+3 -5) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #19851 - Changes `CachedScopeMixin.clean()` to raise non-field specific `ValidationError` - Adds field-specific `ValidationError` to `ScopedForm.clean()` and `ScopedImportForm.clean()` I contemplated creating a re-usable `ScopeRequiredError` exception that sub-classes `ValidataionError` and handles the messaging, to avoid code duplication. Happy to change that if the reviewer disagrees with the decision not to. <!-- Please include a summary of the proposed changes below. --> --- <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:24:30 +01:00
adam closed this issue 2025-12-30 00:24:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15868