[PR #15491] [MERGED] Closes #14279: Pass current request to custom validators #14601

Closed
opened 2025-12-29 23:25:26 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/15491
Author: @jeremystretch
Created: 3/20/2024
Status: Merged
Merged: 3/22/2024
Merged by: @jeremystretch

Base: featureHead: 14279-validator-request-context


📝 Commits (3)

  • 4ea1251 Closes #14279: Pass current request to custom validators
  • e57e077 Update custom validation docs
  • deaaee3 Check that validator is a subclass of CustomValidator

📊 Changes

4 files changed (+124 additions, -34 deletions)

View changed files

📝 docs/customization/custom-validation.md (+22 -3)
📝 netbox/extras/signals.py (+26 -2)
📝 netbox/extras/tests/test_customvalidation.py (+31 -0)
📝 netbox/extras/validators.py (+45 -29)

📄 Description

Fixes: #14279

  • Move run_validators() to extras.signals
  • Extend run_validators() to pass the current request when running a validator
  • Extend the __call__() method on CustomValidator to accept and process a request in addition to an instance
  • Add a test for request validation

🔄 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/15491 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 3/20/2024 **Status:** ✅ Merged **Merged:** 3/22/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `14279-validator-request-context` --- ### 📝 Commits (3) - [`4ea1251`](https://github.com/netbox-community/netbox/commit/4ea1251d8201ca2fe56d73e6a8f0a3ef3ace1e2b) Closes #14279: Pass current request to custom validators - [`e57e077`](https://github.com/netbox-community/netbox/commit/e57e07746be625ffad76a81b81932c3252583135) Update custom validation docs - [`deaaee3`](https://github.com/netbox-community/netbox/commit/deaaee307947686c3e0357353cbe00501eacf1ed) Check that validator is a subclass of CustomValidator ### 📊 Changes **4 files changed** (+124 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `docs/customization/custom-validation.md` (+22 -3) 📝 `netbox/extras/signals.py` (+26 -2) 📝 `netbox/extras/tests/test_customvalidation.py` (+31 -0) 📝 `netbox/extras/validators.py` (+45 -29) </details> ### 📄 Description ### Fixes: #14279 - Move `run_validators()` to `extras.signals` - Extend `run_validators()` to pass the current request when running a validator - Extend the `__call__()` method on CustomValidator to accept and process a request in addition to an instance - Add a test for request validation --- <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-29 23:25:26 +01:00
adam closed this issue 2025-12-29 23:25:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14601