Skip to content

Commit 569041a

Browse files
committed
Changelog for #5963
1 parent 9839885 commit 569041a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/release-notes/version-3.0.md

+25
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
## v3.0-beta1 (FUTURE)
44

5+
### New Features
6+
7+
#### Custom Model Validation ([#5963](https://github.com/netbox-community/netbox/issues/5963))
8+
9+
This release introduces the [`CUSTOM_VALIDATORS`](../configuration/optional-settings.md#custom_validators) configuration parameter, which allows administrators to map NetBox models to custom validator classes to enforce custom validation logic. For example, the following configuration requires every site to have a name of at least ten characters and a description:
10+
11+
```python
12+
from extras.validators import CustomValidator
13+
14+
CUSTOM_VALIDATORS = {
15+
'dcim.site': (
16+
CustomValidator({
17+
'name': {
18+
'min_length': 10,
19+
},
20+
'description': {
21+
'required': True,
22+
}
23+
}),
24+
)
25+
}
26+
```
27+
28+
CustomValidator can also be subclassed to enforce more complex logic by overriding its `validate()` method. See the [custom validation](../additional-features/custom-validation.md) documentation for more details.
29+
530
### Enhancements
631

732
* [#2434](https://github.com/netbox-community/netbox/issues/2434) - Add option to assign IP address upon creating a new interface

0 commit comments

Comments
 (0)